iOS 开发 之 友盟分享

       最近做了个 分享的需求,以前用过shareSDK 的  ,这次尝试了 一下友盟的。

      个人感觉,相比较shareSDK那大大的风格,我还是更喜欢友盟秀气的默认分享面板。很舒服。

      还有很喜欢的 就是 他的截屏分享,简单易懂,很好用。

     这里先插入 一个网址,http://dev.umeng.com/social/ios/share/specific-integration

     这是 友盟iOS开发的 详细文档,集成 在这里 一步一步跟着 文档来, 完全没有问题。


普通分享:



自动监测是否需要授权和自动授权 的 方法;


   [UMSocialSnsService presentSnsIconSheetView:self

                                             appKey:@"53cf4c0256240b9f10013609"

                                          shareText:shareText

                                         shareImage:[UIImage imageNamed:@"icon"]

                                    shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToWechatFavorite,UMShareToWechatSession,UMShareToWechatTimeline,nil]

                                           delegate:self];

        


回调:

-(void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response

{

    //根据`responseCode`得到发送结果,如果分享成功

    if(response.responseCode == UMSResponseCodeSuccess)

    {

        [MxlAppDelegate showStatusWithText:@"成功分享" duration:2];

        MxlCollectionTableViewController *ctr = [[MxlCollectionTableViewController alloc]init];

        [self.navigationController pushViewController :ctr animated:YES];

        

    }

}



截屏分享



注册摇一摇 监听

 //可以设置响应摇一摇阈值,数值越低越灵敏,默认是0.8

    [UMSocialShakeService setShakeThreshold:0.8];

    NSString *shareText = @"说点什么吧...";             //分享内嵌文字

    //下面设置delegateself,执行摇一摇成功的回调,不执行回调可以设为nil

    [UMSocialShakeService setShakeToShareWithTypes:@[UMShareToSina,UMShareToWechatFavorite,UMShareToWechatSession,UMShareToWechatTimeline]

                                         shareText:shareText

                                      screenShoter:[UMSocialScreenShoterDefault screenShoter]

                                  inViewController:self

                                          delegate:self];




//摇一摇代理

-(void)didFinishShareInShakeView:(UMSocialResponseEntity *)response;


{

   

    [self save:nil];

    //根据`responseCode`得到发送结果,如果分享成功

    if(response.responseCode == UMSResponseCodeSuccess)

    {

        [MxlAppDelegate showStatusWithText:@"成功分享" duration:2];

        MxlCollectionTableViewController *ctr = [[MxlCollectionTableViewController alloc]init];

        [self.navigationController pushViewController :ctr animated:YES];

        

    }

   

   

}









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值