美文网首页
ShareSDK更新到4.2.3

ShareSDK更新到4.2.3

作者: hehc08 | 来源:发表于2019-03-18 13:43 被阅读0次

    一.Pod相关

    • 删除WechatOpenSDK文件夹
    • 修改Podfile
    原来的
      pod 'ShareSDK3'
      pod 'MOBFoundation'
      pod 'ShareSDK3/ShareSDKPlatforms/QQ'
      pod 'ShareSDK3/ShareSDKPlatforms/SinaWeibo'
    
    修改成:
    
      pod 'mob_sharesdk'
      pod 'mob_sharesdk/ShareSDKUI'
      pod 'mob_sharesdk/ShareSDKExtension'
      pod 'mob_sharesdk/ShareSDKPlatforms/QQ'
      pod 'mob_sharesdk/ShareSDKPlatforms/SinaWeibo'
      pod 'mob_sharesdk/ShareSDKPlatforms/WeChat'
    

    执行

    pod install
    

    二 .修改ShareSDKHandler.m文件

    • 头文件引用修改:
    //删除
    #import <ShareSDKConnector/ShareSDKConnector.h>
    #import <ShareSDK3/WeiboSDK.h>
    #import <WechatOpenSDK/WXApi.h>
    #import <ShareSDK3/TencentOpenAPI/TencentOAuth.h>
    #import <ShareSDK3/TencentOpenAPI/QQApiInterface.h>
    //增加
    #import <ShareSDK/ShareSDK.h>
    #import <ShareSDK/ShareSDK+Base.h>
    
    • +(void)registerPlatforms 方法里的代码修改成:
        [ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
            //QQ
            [platformsRegister setupQQWithAppId:qqAppID appkey:qqAppKey];
            //微信
            [platformsRegister setupWeChatWithAppId:wechatAppID appSecret:wechatAppSecret];
            //新浪
            [platformsRegister setupSinaWeiboWithAppkey:weiboAppKey appSecret:weiboAppSecret redirectUrl:weiboRedirectURL];
        }];
    
    • +(void)authorizeIfNeeded:completion:方法修改:
    [ShareSDK cancelAuthorize:platformType];
    
    修改成
    
    [ShareSDK cancelAuthorize:platformType result:^(NSError *error) {
        NSLog(@"cancelAuthorize error:%@",error.localizedDescription);
    }];
    
    
    • 文件里与微信分享相关的代码,有6处
     [parameters SSDKSetupWeChatParamsByText:text title:title url:URL thumbImage:thumbImage image:image musicFileURL:mediaURL extInfo:nil fileData:nil emoticonData:nil type:contentType forPlatformSubType:platformType];
    
    修改成
    
     [parameters SSDKSetupWeChatParamsByText:text title:title url:URL thumbImage:thumbImage image:image musicFileURL:mediaURL extInfo:nil fileData:nil emoticonData:nil sourceFileExtension:nil sourceFileData:nil type:contentType forPlatformSubType:platformType];
    
    

    相关文章

      网友评论

          本文标题:ShareSDK更新到4.2.3

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