iOS shareSDK分享 只分享到微信好友和微信朋友圈

//分享配置
- (void)setUpShareSDK{

  /**初始化ShareSDK应用
     */
    [ShareSDK registerActivePlatforms:@[
                                        @(SSDKPlatformSubTypeWechatSession),//微信好友
                                        @(SSDKPlatformSubTypeWechatTimeline),//微信朋友圈
                                        ]
                             onImport:^(SSDKPlatformType platformType)
     {
         switch (platformType)
         {
             case SSDKPlatformTypeWechat:
             [ShareSDKConnector connectWeChat:[WXApi class]];
             break;
             
             default:
             break;
         }
     }
     
     
    onConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary *appInfo)
     {
         switch (platformType)
         {
             
             case SSDKPlatformTypeWechat:
             [appInfo SSDKSetupWeChatByAppId:@"wx4868b35061f87885"
                                   appSecret:@"558b231f64dce8fdf7a02d35386593bb"];
             break;
             
             default:
             break;
             
         }
         
     }];
//(注意:每一个case对应一个break不要忘记填写,不然很可能有不必要的错误,新浪微博的外部库如果不要客户端分享或者不需要加关注微博的功能可以不添加,否则要添加,QQ,微信,google+这些外部库文件必须要加)
              

}


//分享完成后的的回调

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
    dispatch_async(dispatch_get_main_queue(), ^{
        [WXApi handleOpenURL:url delegate:self];
    });
    return YES;
    
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
    dispatch_async(dispatch_get_main_queue(), ^{
        [WXApi handleOpenURL:url delegate:self];
    });
    return YES;
    
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
    dispatch_async(dispatch_get_main_queue(), ^{
        [WXApi handleOpenURL:url delegate:self];
    });
    return YES;
}

输入图片说明

转载于:https://my.oschina.net/wenchengxu123/blog/1537241

评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符 “速评一下”
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页