iOS-友盟单个分享

分享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-友盟单个分享)