NSAppTransportSecurity& Facebook的

时间:2015-09-21 12:06:17

标签: ios9 xcode7 nsapptransportsecurity

在iOS 9下,我的UIWebview加载公司的Facebook页面只能将NSAllowsArbitraryLoads键设置为YES,否则会导致以下错误:

NSURLSession / NSURLConnection HTTP加载失败(kCFStreamErrorDomainSSL,-9802)

任何sugestions?

1 个答案:

答案 0 :(得分:4)

打开您的Info.plist文件作为源代码,并确保“NSAppTransportSecurity”键看起来像这样(https://developers.facebook.com/docs/ios/ios9上的更多信息)

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <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>
    </dict>
</dict>