HTTP 加载失败(kCFStreamErrorDomainSSL,-9806(IOS9)
HTTP load failed (kCFStreamErrorDomainSSL, -9806 ( IOS9)
我在 iOS 9 上 NSURLSession/NSURLConnection HTTP 加载失败,而 运行 应用程序在模拟器上。
这是我的 info.plist 文件的样子
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow insecure HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
即使在输入这些键值后,Xcode 控制台上仍显示相同的错误。请协助。
这是info.plist
的截图
非常感谢!
您需要定义要为其应用这些规则的 URL。
您可以在 Apple 的文档页面上找到正确的声明:
https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/
所以基本上您的 Info.plist 应该看起来像这样并包含域。
注意:为了更好的透明度,我还重新声明了 NSAllowsArbitraryLoads
的默认值是 false
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
此致。
如果您不关心所有这些 ssl 混乱(我不推荐这样做)并且只想去调试您的 UI,您也可以暂时使用非-App TransportSecurity 的默认值并允许任何内容:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
我不确定 Apple 是否会在 AppStore 审核中通过它;-)
我在 iOS 9 上 NSURLSession/NSURLConnection HTTP 加载失败,而 运行 应用程序在模拟器上。 这是我的 info.plist 文件的样子
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow insecure HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
即使在输入这些键值后,Xcode 控制台上仍显示相同的错误。请协助。
这是info.plist
非常感谢!
您需要定义要为其应用这些规则的 URL。 您可以在 Apple 的文档页面上找到正确的声明: https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/
所以基本上您的 Info.plist 应该看起来像这样并包含域。
注意:为了更好的透明度,我还重新声明了 NSAllowsArbitraryLoads
的默认值是 false
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
此致。
如果您不关心所有这些 ssl 混乱(我不推荐这样做)并且只想去调试您的 UI,您也可以暂时使用非-App TransportSecurity 的默认值并允许任何内容:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
我不确定 Apple 是否会在 AppStore 审核中通过它;-)