更新到新发布的Xcode 7版本后,我遇到了这个问题。明文HTTP被阻止
由于App Transport Security不安全,App Transport Security阻止了明文HTTP(http://)资源加载。临时例外可以通过您的应用程序的Info.plist文件进行配置。 gete由于App Transport安全策略要求使用安全连接,因此无法加载资源。
我做了一些搜索,我发现解决方案,说这些行添加到我的项目中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调用。 – execv
我做了同样的问题仍然 –
好吧,这似乎很奇怪。我只是检查它和它的工作。请告诉我们您的info.plist?为了确保,您需要将'NSAppTransportSecurity'作为字典添加到'NSAllowsArbitraryLoads'中作为布尔值,并将其设置为YES。 – execv