美文网首页
iOS-友盟单个分享

iOS-友盟单个分享

作者: lancely | 来源:发表于2016-09-20 10:02 被阅读82次

分享URL链接

  1. 微信好友
[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(@"分享成功!");
    }
}];
  1. 微信朋友圈
[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(@"分享成功!");
    }
}];
  1. 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(@"分享成功!");
    }
}];
  1. 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(@"分享成功!");
    }
}];
  1. 新浪微博
// 新浪微博分享比较特殊,直接把链接放到内容里面
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(@"分享成功!");
    }
}];

相关文章

网友评论

      本文标题:iOS-友盟单个分享

      本文链接:https://www.haomeiwen.com/subject/qktoettx.html