您的位置:首页 > 移动开发 > IOS开发

ios 友盟集成分享 细节

2015-12-19 13:45 483 查看
//分享到 微信
UMSocialData
defaultData].extConfig.wechatSessionData.wxMessageType=UMSocialWXMessageTypeWeb
;
[UMSocialData
defaultData].extConfig.wechatSessionData.title = title;
[UMSocialData
defaultData].extConfig.wechatSessionData.url = fxurl;
[[UMSocialDataService
defaultDataService] postSNSWithTypes:@[UMShareToWechatSession]
content:content image:Image
location:nil
urlResource:nil
presentedController:self
completion:^(UMSocialResponseEntity *response){

if (response.responseCode ==
UMSResponseCodeSuccess) {

// NSLog(@"=====分享成功!");
[MBProgressHUD
showSuccess:@"分享成功"
toView: [UIApplication
sharedApplication].keyWindow];
}else{
[MBProgressHUD
showSuccess:@"分享失败"
toView: [UIApplication
sharedApplication].keyWindow];
}
//分享到微信朋友圈

[UMSocialData
defaultData].extConfig.wechatTimelineData.wxMessageType=UMSocialWXMessageTypeWeb;
[UMSocialData
defaultData].extConfig.wechatTimelineData.title =title;
[UMSocialData
defaultData].extConfig.wechatTimelineData.url =fxurl;

[[UMSocialDataService
defaultDataService] postSNSWithTypes:@[UMShareToWechatTimeline]
content:content image:Image
location:nil
urlResource:nil
presentedController:self
completion:^(UMSocialResponseEntity *response){
if (response.responseCode ==
UMSResponseCodeSuccess) {
// NSLog(@"分享成功!");
[MBProgressHUD
showSuccess:@"分享成功"
toView: [UIApplication
sharedApplication].keyWindow];
}else{
[MBProgressHUD
showSuccess:@"分享失败"
toView: [UIApplication
sharedApplication].keyWindow];
}
}];
//分享到新浪
我是把需要分享的url 拼接到 字符串title后面

[[UMSocialControllerService
defaultControllerService]
setShareText:[((HEPostDetail *)self.obj).title
stringByAppendingString:FXURl]
shareImage:Image
socialUIDelegate:self];
//设置分享内容和回调对象
[UMSocialSnsPlatformManager
getSocialPlatformWithName:UMShareToSina].snsClickHandler(self,[UMSocialControllerService
defaultControllerService],YES);

// 分享到qq

[UMSocialData
defaultData].extConfig.qqData.title =title;
[UMSocialData
defaultData].extConfig.qqData.url =fxurl;
[[UMSocialDataService
defaultDataService] postSNSWithTypes:@[UMShareToQQ]
content:content image:Image
location:nil
urlResource:nil
presentedController:self
completion:^(UMSocialResponseEntity *response) {
if (response.responseCode ==
UMSResponseCodeSuccess) {
[MBProgressHUD
showSuccess:@"分享成功"
toView: [UIApplication
sharedApplication].keyWindow];
} else {
[MBProgressHUD
showSuccess:@"分享失败"
toView: [UIApplication
sharedApplication].keyWindow];
}
}];

deleget 写的内容

[UMSocialData
setAppKey:HEYMappKey];

//设置微信AppId,设置分享url,默认使用友盟的网址
[UMSocialWechatHandler
setWXAppId:@"wx23d0f5f7092747fd"
appSecret:@"d4624c36b6795d1d99dcf0547af5443d"
url:@"http://www.umeng.com/social"];

//设置手机QQ的AppId,指定你的分享url,若传nil,将使用友盟的网址
[UMSocialQQHandler
setQQWithAppId:@"1104959016"
appKey:@"dygzlznZv3eGRWgq"
url:@"http://www.umeng.com/social"];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: