将域例外添加到App Transport Security ios9

时间:2015-09-23 07:08:50

标签: objective-c swift ios9 app-transport-security

我在plist中使用以下代码将我的服务器异常添加到App Transport Security协议。

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>172.16.4.139</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSThirdPartyExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSRequiresCertificateTransparency</key>
            <false/>
        </dict>
    </dict>
</dict>

但是它给出了消息“无法加载资源,因为App Transport Security策略要求使用安全连接。”。

我做错了什么?

1 个答案:

答案 0 :(得分:2)

  

硬编码的IP地址在iOS 9中不起作用。

检查this answer