友盟分享是碰到微信未能安装等错误

碰到以上情况有两种可能,一种是https和http传输协议的问题,还有一个就是应用跳转的问题,友盟的官方文档上写的很清楚,我就直接复制过来了。

1.  HTTP传输安全

以iOS9 SDK编译的工程会默认以SSL安全协议进行网络传输,即HTTPS,如果依然使用HTTP协议请求网络会报系统异常并中断请求。目前可用如下两种方式保持用HTTP进行网络连接:

A、在info.plist中加入安全域名白名单(右键info.plist用source code打开)

NSAppTransportSecurity

    NSExceptionDomains
    
        log.umsns.com
        
            NSIncludesSubdomains
            <true/>
            NSTemporaryExceptionAllowsInsecureHTTPLoads
            <true/>
            NSTemporaryExceptionMinimumTLSVersion
            <string>TLSv1.1string>
        
        sns.whalecloud.com
        
            NSIncludesSubdomains
            <true/>
            NSTemporaryExceptionAllowsInsecureHTTPLoads
            <true/>
            NSTemporaryExceptionMinimumTLSVersion
            <string>TLSv1.1string>
        

        
        sina.cn
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        weibo.cn
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        weibo.com
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionAllowsInsecureHTTPLoads
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        sinaimg.cn
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionAllowsInsecureHTTPLoads
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        sinajs.cn
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionAllowsInsecureHTTPLoads
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        sina.com.cn
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionAllowsInsecureHTTPLoads
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        

        
        qq.com
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionAllowsInsecureHTTPLoads
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        

        
        renren.com
        
            NSIncludesSubdomains
            <true/>
            NSThirdPartyExceptionAllowsInsecureHTTPLoads
            <true/>
            NSThirdPartyExceptionRequiresForwardSecrecy
            <false/>
        
        

        
        facebook.com
        
            NSIncludesSubdomains
            <true/>                
            NSExceptionRequiresForwardSecrecy
            <false/>
        
        fbcdn.net
        
            NSIncludesSubdomains
            <true/>
            NSExceptionRequiresForwardSecrecy
            <false/>
        
        akamaihd.net
        
            NSIncludesSubdomains
            <true/>
            NSExceptionRequiresForwardSecrecy
            <false/>
        
        

        
        twitter.com
        
            NSIncludesSubdomains
            <true/>                
            NSExceptionRequiresForwardSecrecy
            <false/>
        
        
    

注:以上部分平台官方未给出相应白名单,由技术人员测试各个平台所收集而来,如果有所遗漏,请自行加入并向客服说明,我们会进一步补充名单。

B、在info.plist的NSAppTransportSecurity下新增NSAllowsArbitraryLoads并设置为YES,指定所有HTTP连接都可正常请求

NSAppTransportSecurity

    NSAllowsArbitraryLoads
    <true/>

2.  应用跳转(SSO等)

如果你的应用使用了如SSO授权登录或跳转分享功能,在iOS9下就需要增加一个可跳转的白名单,指定对应跳转App的URL Scheme,否则将在第三方平台判断是否跳转时用到的canOpenURL时返回NO,进而只进行webview授权或授权/分享失败。
同样在info.plist增加:

LSApplicationQueriesSchemes

    
    <string>wechatstring>
    <string>weixinstring>

    
    <string>sinaweibohdstring>
    <string>sinaweibostring>
    <string>sinaweibossostring>
    <string>weibosdkstring>
    <string>weibosdk2.5string>

    
    <string>mqqapistring>
    <string>mqqstring>
    <string>mqqOpensdkSSoLoginstring>
    <string>mqqconnectstring>
    <string>mqqopensdkdatalinestring>
    <string>mqqopensdkgrouptribesharestring>
    <string>mqqopensdkfriendstring>
    <string>mqqopensdkapistring>
    <string>mqqopensdkapiV2string>
    <string>mqqopensdkapiV3string>
    <string>mqzoneopensdkstring>
    <string>wtloginmqqstring>
    <string>wtloginmqq2string>
    <string>mqqwpastring>
    <string>mqzonestring>
    <string>mqzonev2string>
    <string>mqzonesharestring>
    <string>wtloginqzonestring>
    <string>mqzonewxstring>
    <string>mqzoneopensdkapiV2string>
    <string>mqzoneopensdkapi19string>
    <string>mqzoneopensdkapistring>
    <string>mqqbrowserstring>
    <string>mttbrowserstring>

    
    <string>alipaystring>
    <string>alipaysharestring>


    
    <string>renreniosstring>
    <string>renrenapistring>
    <string>renrenstring>
    <string>renreniphonestring>

    
    <string>laiwangssostring>

    
    <string>yixinstring>
    <string>yixinopenapistring>

    
    <string>instagramstring>

    
    <string>whatsappstring>

    
    <string>linestring>

    
    <string>fbapistring>
    <string>fb-messenger-apistring>
    <string>fbauth2string>
    <string>fbshareextensionstring>

3.  应用瘦身(App Thining)

iOS9 SDK新增了对App瘦身的功能,详情见App Thining。目前各个第三方平台正在进行App thining的支持,所以为了正常使用第三方SDK及分享SDK,需要在Build Setting中将Enable bitcode关闭,或设置编译标识ENABLE_BITCODE=NO。
注:bitcode仅在Xcode7以上显示并默认开启。

 

转载于:https://www.cnblogs.com/zhizunbao/p/5599729.html

你可能感兴趣的:(友盟分享是碰到微信未能安装等错误)