2016-03-06 64 views
0

我將此添加到我的應用程序Info.plist文件退出ATS的:禁用應用程序傳輸安全,從HTTP訪問仍然被阻塞

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
</dict> 

,當我嘗試做從GET請求仍然得到這個錯誤我的HTTP資源(具有對服務器無法控制):

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. 

我的完整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>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSAllowsArbitraryLoads</key><true/> 
    </dict> 
    <key>CFBundleDevelopmentRegion</key> 
    <string>en</string> 
    <key>CFBundleExecutable</key> 
    <string>$(EXECUTABLE_NAME)</string> 
    <key>CFBundleIdentifier</key> 
    <string>com.owlpixel.xxxxx</string> 
    <key>CFBundleInfoDictionaryVersion</key> 
    <string>6.0</string> 
    <key>CFBundleName</key> 
    <string>$(PRODUCT_NAME)</string> 
    <key>CFBundlePackageType</key> 
    <string>FMWK</string> 
    <key>CFBundleShortVersionString</key> 
    <string>1.0</string> 
    <key>CFBundleSignature</key> 
    <string>????</string> 
    <key>CFBundleVersion</key> 
    <string>$(CURRENT_PROJECT_VERSION)</string> 
    <key>NSPrincipalClass</key> 
    <string></string> 
</dict> 
</plist> 

ATS應該被禁用,爲什麼它仍然阻止我?有任何想法嗎?

+1

檢查此問題,似乎是同樣的問題,檢查第一個解決方案是否可以幫助您http://stackoverflow.com/questions/32761042/swift-app-transport-security-has-blocked-a-cleartext-http-resource – UlyssesR

+0

我也嘗試了「NSExceptionDomains」並添加了我的域 - 相同的結果 – mindbomb

+0

您是否嘗試過所有經典的「項目神祕清理」,cmd + shfit + k /派生數據等等? – UlyssesR

回答

0

嘗試尋找是否有你很多的.plist文件的Xcode項目(或Workspace)。

我有同樣的問題,這是通過查找我的工作區所有Info.plist文件,並添加NSAppTransportSecurity邏輯來負責外部(http://)調用.plist文件來解決。

相關問題