美文网首页
MobShareSDK 分享

MobShareSDK 分享

作者: Crassus | 来源:发表于2021-08-17 16:23 被阅读0次

    1.iOS 微信好友和微信朋友圈分享

    桥接头部添加

    // 分享
    #import <ShareSDK/ShareSDK.h>
    #import <ShareSDKUI/ShareSDKUI.h>
    #import <ShareSDKUI/ShareSDK+SSUI.h>
    #import <ShareSDKUI/SSUIShareSheetConfiguration.h>
    

    具体微信分享

         // 用于排查微信配置问题打印
           WXApi.startLog(by: .detail) { msg in
                print("WX------\(msg)")
            }
            
           // 配置分享参数
            let shareParams = NSMutableDictionary()
            let logo = Bundle.main.path(forResource: "shareLogo", ofType: "png")
            let url = URL(string: link)
            shareParams.ssdkSetupShareParams(byText: text, images:[logo] , url: url, title: "好眠日报", type: .webPage)
    
           // 直接调用微信聊天发送信息
    //        ShareSDK.share(byActivityViewController: .typeWechat, parameters: shareParams) { state, userData, contentEntity, error in
    //            print("\(state) \(String(describing: userData)) \(String(describing: contentEntity)) \(String(describing: error))")
    //        }
    
        // 直接调用微信聊天发送信息
    //        ShareSDK.share(.subTypeWechatTimeline, parameters: shareParams) { state, userData, contentEntity, error in
    //            print("\(state) \(String(describing: userData)) \(String(describing: contentEntity)) \(String(describing: error))")
    //        }
    
          // 弹框展示显示微信朋友圈和微信好友分享
            let items = [SSDKPlatformType.subTypeWechatSession.rawValue , SSDKPlatformType.subTypeWechatTimeline.rawValue]
            let config = SSUIShareSheetConfiguration()
            ShareSDK.showShareActionSheet(nil, customItems: items, shareParams: shareParams, sheetConfiguration: config) { state, type, userData, contentEntity, error, end in
            }
    

    遇到弹框显示本地化问题

    // Info.plist增加配置 解决
    Localization native development region    zh
    Localizations  
        Item0   Chinese (simplified)
    

    相关文章

      网友评论

          本文标题:MobShareSDK 分享

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