Api Xcode 7 / iOS 9 中的调用错误(如何在 plist 中设置 App Transport Security)
Api Call Error in Xcode 7 / iOS 9 (how to setup App Transport Security in plist)
我正在使用 xcode 7 测试版。
现在,我正在 API 工作。如果,我在 Xcode 6.3 中使用 API 它工作正常但是当我在 xcode 中使用相同的 API 时出现 7 错误消息无法解析。
请帮帮我。提前致谢
在 iOS9 中,Apple 添加了名为 App Transport Security (ATS) 的新功能。
ATS 在网络调用期间强制实施最佳实践,包括使用 HTTPS。
Apple 预发布文档:
ATS prevents accidental disclosure, provides secure default behavior,
and is easy to adopt. You should adopt ATS as soon as possible,
regardless of whether you’re creating a new app or updating an
existing one.
If you’re developing a new app, you should use HTTPS exclusively. If
you have an existing app, you should use HTTPS as much as you can
right now, and create a plan for migrating the rest of your app as
soon as possible.
在您的 info.plist 中添加 Below 键,然后查看。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
甚至你可以添加特定的例外,
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>testdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<false/>
<key>NSExceptionAllowInsecureHTTPSLoads</key>
<false/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionAllowInsecureHTTPSLoads</key>
<false/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSRequiresCertificateTransparency</key>
<false/>
</dict>
...
</dict>
</dict>
您可以按照这个简单的步骤操作..
在你里面添加以下内容info.plist
NSAppTransportSecurity<br>
NSAllowsArbitraryLoads
这对你有帮助。
我正在使用 xcode 7 测试版。 现在,我正在 API 工作。如果,我在 Xcode 6.3 中使用 API 它工作正常但是当我在 xcode 中使用相同的 API 时出现 7 错误消息无法解析。
请帮帮我。提前致谢
在 iOS9 中,Apple 添加了名为 App Transport Security (ATS) 的新功能。
ATS 在网络调用期间强制实施最佳实践,包括使用 HTTPS。
Apple 预发布文档:
ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.
If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible.
在您的 info.plist 中添加 Below 键,然后查看。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
甚至你可以添加特定的例外,
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>testdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<false/>
<key>NSExceptionAllowInsecureHTTPSLoads</key>
<false/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionAllowInsecureHTTPSLoads</key>
<false/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSRequiresCertificateTransparency</key>
<false/>
</dict>
...
</dict>
</dict>
您可以按照这个简单的步骤操作..
在你里面添加以下内容info.plist
NSAppTransportSecurity<br>
NSAllowsArbitraryLoads
这对你有帮助。