【发布时间】:2015-12-15 19:46:29
【问题描述】:
更新到新发布的 Xcode 7 版本后,我遇到了这个问题。
应用传输安全已阻止明文 HTTP (http://) 资源加载,因为它不安全。可以通过应用程序的 Info.plist 文件配置临时例外。 gete 无法加载资源,因为应用传输安全策略要求使用安全连接。
我做了一些搜索,找到了将这些行添加到我项目中的 info.plist 文件的解决方案,但问题没有解决
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.thenewsapp.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>greenarea.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
</dict>
</plist>
任何帮助
【问题讨论】:
-
为什么不将
NSAllowsArbitraryLoads设置为true?这样你就可以进行所有的 HTTP 调用了。 -
我做了同样的问题仍然存在
-
嗯,这看起来很奇怪。我刚刚检查了它及其工作。请告诉我们您的 info.plist 吗?为确保,您需要将
NSAppTransportSecurity添加为字典,并在其中添加NSAllowsArbitraryLoads作为布尔值并将其设置为 YES。 -
请检查我的问题编辑
-
你能把
NSAllowsArbitraryLoads之后的所有内容都删除在NSAppTransportSecurity字典里,然后再试一次吗?
标签: ios iphone swift2 ios9 xcode7