Transport security has blocked a cleartext HTTP

What setting do I need to put in my info.plist to enable HTTP mode as per the following error message?

Transport security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

Xcode中

Assume that my domain is example.com .


If you are using Xcode 8.0 and Swift 3.0 or Swift 2.2 or even Objective C:

在这里输入图片说明

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>example.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

Use:

在这里输入图片说明

You have to set the NSAllowsArbitraryLoads key to YES under NSAppTransportSecurity dictionary in your .plist file.

Plist配置


Here are the settings visually:

通过Xcode GUI在info.plist中NSAllowsArbitraryLoads的可视化设置

链接地址: http://www.djcxy.com/p/85294.html

上一篇: 无法在Android Studio中打开布局

下一篇: 传输安全性阻止了明文HTTP