美文网首页IOS个人开发
iOS分享到国外社交APP调研

iOS分享到国外社交APP调研

作者: 华南犀牛 | 来源:发表于2019-05-20 11:51 被阅读0次

跳转到app都需要添加到白名单

在不使用第三方的情况下,采用系统原生的方法,实现分享功能。有两种方式: 一种是使用UIActivityViewController,另外一种是使用Social框架中的SLComposeViewController
从iOS11开始,系统不允许跳过前面的选择面板直接进行第三方平台分享(实际上是来到了但立刻被dismiss了),所以,iOS11后只能采用第一种方式!

UIActivityViewController: 来弹出分享面板
SLComposeViewController: 来跳过分享面板直接进行第三方平台分享

因需求需要 , 需要调研下列几个国外社区三方应用的分享.

  • Facebook

    • 白名单
    <string>fbshareextension</string>
    <string>fb</string>
    <string>fb2298965036780837</string>
    <string>fbapi</string>
    <string>fbapi20130214</string>
    <string>fbapi20130410</string>
    <string>fbapi20130702</string>
    <string>fbapi20131010</string>
    <string>fbapi20131219</string>
    <string>fbapi20140410</string>
    <string>fbapi20140116</string>
    <string>fbapi20150313</string>
    <string>fbapi20150629</string>
    <string>fbauth</string>
    <string>fbauth2</string>
    

  • Messenger

    • 白名单
    <string>fb-messenger-share-api</string>
    <string>fb-messenger-platform-20150128</string>
    <string>fb-messenger-platform-20150218</string>
    <string>fb-messenger-platform-20150305</string>
    <string>fb-messenger-api20140430</string>
    <string>fb-messenger-api</string>
    
    • 系统分享: activityType = com.facebook.Messenger.ShareExtension
      • 未登录下, 在应用内调用Messenger系统分享会出现报错弹窗
      • Messenger系统分享支持url 图片 title
    • SDK分享:
      • 回调和FB分享一致(可获得成功/失败/取消回调)
      • FBSDKMessageDialog(分享弹窗) \ FBSDKShareLinkContent (分享内容)
    • 网页分享(已失效):

  • Twitter

    • 白名单
    <string>twitter</string>
    
    • 系统分享: activityType = com.apple.UIKit.activity.PostToTwitter
      • 分享支持url 图片 title
      • iOS11之后国行手机无法测试
    • SDK分享:
      • 回调和FB分享一致(可获得成功/失败/取消回调)
      • 不再维护
    • 网页分享:

  • Google+

    • 白名单
    <string>gplus</string>
    
    • 系统分享: activityType = com.google.GooglePlus.ShareExtension
      • 分享支持url 图片 title
    • SDK分享: (无)
    • 打开app深度链接分享[openURL]: (gplus:/) ---- text内容需要UTF8编码
      • gplus:/share?text={utf-8 text}
    • 网页分享:

  • WhatsApp

    • 白名单
    <string>whatsapp</string>
    
    • 系统分享: activityType = net.whatsapp.WhatsApp.ShareExtension
      • 分享支持url 图片 title
    • SDK分享: (无)
    • 打开app深度链接分享[openURL]: (whatsapp://) ---- text内容需要UTF8编码
    • 网页分享: (需翻墙)
      • https://wa.me/?text={utf-8 text}
      • 不建议使用H5分享,最终也会重定向到whatsapp:// 跳转应用分享, 否则会是引导页 {需要第三方APP支持}

  • VK

    • 白名单
    <string>vk</string>
    <string>vk-share</string>
    <string>vkauthorize</string>
    
    //pod 'VK-ios-sdk'
    
    //注意事项,一定要放在FB后面
    //Note: if you already have FaceBook SDK added and one of this methods returns   //[FBSDKDelegate ...] you can handle it
    -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:  (NSString *)sourceApplication annotation:(id)annotation {
    
        [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
    
        // 放到后面..
        [VKSdk processOpenURL:url fromApplication:sourceApplication];
    
         return YES;
    }
    //注: VKShareDialogControllerResult 分享状态只有:取消 \ 完成 (无分享成功失\败)
    


  • Telegram

    • 白名单
    <string>tg</string>
    
    • 系统分享: activityType = ph.telegra.Telegraph.Share
      • 分享支持url 图片 title
    • SDK分享: (无)
    • 打开app深度链接分享[openURL]: (tg://) [内容需utf-8, 支持很好]
    • 网页内分享

  • Pinterest

    • 系统分享: activityType = pinterest.ShareExtension
      • 分享支持url 图片 title
    • SDK分享: (无)
    • 打开app深度链接分享[openURL]: (pinterest://) -- 暂只能打开app
      • pinterest://
    • 网页内分享 (text不需要utf8编码, 否则框内文字会显示编码后文字)

  • Instagram

    • 白名单
    <string>instagram-stories</string>
    <string>instagram</string>
    <string>instagram-capture</string>
    
    • 系统分享: activityType = com.burbn.instagram.shareextension

      • 图片
    • SDK分享: (无)

    • 打开app深度链接分享[openURL]: (instagram://) 暂只能打开app https://www.instagram.com/developer/mobile-sharing/iphone-hooks/

      
      NSURL *urlScheme = [NSURL URLWithString:@"instagram-stories://share"];
      if ([[UIApplication sharedApplication] canOpenURL:urlScheme]) {
      // Assign background image asset and attribution link URL to pasteboard
      NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:self.shareImageUrl]];
      NSArray *pasteboardItems = @[@{@"com.instagram.sharedSticker.backgroundImage" : data, @"com.instagram.sharedSticker.contentURL" : self.shareURL}]; NSDictionary *pasteboardOptions = @{UIPasteboardOptionExpirationDate : [[NSDate date] dateByAddingTimeInterval:60 * 5]};
      // This call is iOS 10+, can use 'setItems' depending on what versions you support
      
      [[UIPasteboard generalPasteboard] setItems:pasteboardItems options:pasteboardOptions];
      [[UIApplication sharedApplication] openURL:urlScheme options:@{} completionHandler:^(BOOL success) {
          if (success) {
              [self leaveCurrentAPPToThirdApp];
          }
      }];
      }   
      
      • 方式二(间接分享 - 再弹出系统分享选择): 分享igo文件的形式,弹起类似系统更多分享弹窗,拷贝到Instagram [速卖通 ins分享方式]
      
       NSString *documentDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
          // *.igo is exclusive to instagram
          NSString *saveImagePath = [documentDirectory stringByAppendingPathComponent:@"Image.igo"];
      //        NSData *imageData = UIImagePNGRepresentation(filteredImage);
          [data writeToFile:saveImagePath atomically:YES];
      
          NSURL *imageURL=[NSURL fileURLWithPath:saveImagePath];
      
          _docController=[[UIDocumentInteractionController alloc]init];
          _docController.delegate=self;
          _docController.UTI=@"com.instagram.photo";
          [_docController setURL:imageURL];
          _docController.annotation=[NSDictionary dictionaryWithObjectsAndKeys:@"#yourHashTagGoesHere",@"InstagramCaption", nil];
          [_docController presentOpenInMenuFromRect:CGRectZero inView:[UIViewController bgl_currentViewController].view animated:YES];  
      
      • 方式三(间接分享 - 再弹出系统分享选择): ps: 只能纯分享UIImage , Text或者URL不能分享, 分享则没有Ins这个Ativity
    • 网页内分享 (无)

.
.
.
.
.
.

没装三方客户端不能实现分享(无网页分享 ): Instagram[无] / Line [重定向跳转空白页] / WhatsApp[重定向引导] / Messenger[无] / Telegram [跳转引导]

相关文章

网友评论

    本文标题:iOS分享到国外社交APP调研

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