分享URL链接
- 微信好友
[UMSocialData defaultData].extConfig.wechatSessionData.title = @"分享标题";
[UMSocialData defaultData].extConfig.wechatSessionData.url = @"分享链接";
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatSession] content:@"分享内容" image:[UIImage imageNamed:@"xxx"] location:nil urlResource:nil presentedController:nil completion:^(UMSocialResponseEntity *shareResponse){
if (shareResponse.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];
- 微信朋友圈
[UMSocialData defaultData].extConfig.wechatTimelineData.title = @"分享标题";
[UMSocialData defaultData].extConfig.wechatTimelineData.url = @"分享链接";
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatTimeline] content:@"分享内容" image:[UIImage imageNamed:@"xxx"] location:nil urlResource:nil presentedController:nil completion:^(UMSocialResponseEntity *shareResponse){
if (shareResponse.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];
- QQ
[UMSocialData defaultData].extConfig.qqData.url = @"分享链接";
[UMSocialData defaultData].extConfig.qqData.title = @"分享标题";
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToQQ] content:@"分享内容" image:[UIImage imageNamed:@"xxx"] location:nil urlResource:nil presentedController:nil completion:^(UMSocialResponseEntity *shareResponse) {
if (shareResponse.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];
- QQ空间
[UMSocialData defaultData].extConfig.qzoneData.title = @"分享标题";
[UMSocialData defaultData].extConfig.qzoneData.url = @"分享链接";
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToQzone] content:@"分享内容" image:[UIImage imageNamed:@"xxx"] location:nil urlResource:nil presentedController:nil completion:^(UMSocialResponseEntity *shareResponse) {
if (shareResponse.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];
- 新浪微博
// 新浪微博分享比较特殊,直接把链接放到内容里面
NSString *shareContent = [@"分享内容" stringByAppendingString:@"分享链接"];
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToSina] content:shareContent image:[UIImage imageNamed:@"xxx"] location:nil urlResource:nil presentedController:nil completion:^(UMSocialResponseEntity *shareResponse) {
if (shareResponse.responseCode == UMSResponseCodeSuccess) {
NSLog(@"分享成功!");
}
}];