新浪微博第三方登陆

来源:互联网 发布:通用矩阵分析 编辑:程序博客网 时间:2024/05/06 19:57

详细的网址:http://dev.umeng.com/social/ios/detail-share#7

1.注册友盟账号

登陆友盟官网,在我的产品页面添加新应用,然后获取到AppKey

11.友盟官网:http://www.umeng.com/?ticket=ST-1448505298rhq1wxh-RATmckqADsM


2.然后选择我的产品


3.然后选择添加新应用,按要求填写内容就行,平台选择第二个苹果,然后提交并获取AppKey


4.然后下载SDK:http://dev.umeng.com/social/ios/sdk-download,勾选你需要的第三方登陆的软件,选择下载即可


5.SDK就是一个文件夹,打开文件夹有三个子文件夹,全部拖到你的工程里面就行

接下来就是代码部分,首先是Appdelegate.m部分,引入友盟头文件,代码部分写的是你获取到的AppKey



然后到你点击登陆按钮的那个页面的点击方法里面去实现


这样代码部分就实现了

然后就该配置了



第四步:

    在Xcode7.0中要在plist文件中添加三段文件

第一段:
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>log.umsns.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
        </dict>
        <key>sns.whalecloud.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
        </dict>

        <!-- 集成新浪微博对应的HTTP白名单-->
        <key>sina.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>weibo.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>weibo.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>sinaimg.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>sinajs.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>sina.com.cn</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <!-- 新浪微博-->

        <!-- 集成微信、QQ、Qzone、腾讯微博授权对应的HTTP白名单-->
        <key>qq.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <!-- 腾讯授权-->

        <!-- 集成人人授权对应的HTTP白名单-->
        <key>renren.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <!-- 人人授权-->

        <!-- 集成Facebook授权对应的HTTP白名单-->
        <key>facebook.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>                
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <!-- Facebook授权-->

        <!-- 集成Twitter授权对应的HTTP白名单-->
        <key>twitter.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>                
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <!-- Twitter授权-->
    </dict>
</dict>



第二段:
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>


第三段:
<key>LSApplicationQueriesSchemes</key>
<array>
    <!-- 微信 URL Scheme 白名单-->
    <string>wechat</string>
    <string>weixin</string>

    <!-- 新浪微博 URL Scheme 白名单-->
    <string>sinaweibohd</string>
    <string>sinaweibo</string>
    <string>sinaweibosso</string>
    <string>weibosdk</string>
    <string>weibosdk2.5</string>



第五步:

   在Link中引入SystemConfiguration.framework这个类库




第六步:

   在info.plist的NSAppTransportSecurity (类型设置为dictionary)下新增NSAllowsArbitraryLoads并设置为YES





这样就完成了
















0 0