最近做了个 分享的需求,以前用过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 = @"说点什么吧..."; //分享内嵌文字
//下面设置delegate为self,执行摇一摇成功的回调,不执行回调可以设为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];
}
}