簡體   English   中英

禁用了應用程序傳輸安全性,仍然無法通過HTTP訪問

[英]Disabled App Transport Security, still getting blocked from HTTP access

我將此添加到我的應用程序Info.plist文件中以選擇退出ATS:

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

當我嘗試從http資源發出GET請求時仍然出現此錯誤(無法控制服務器):

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,為什么它仍然阻止我? 有任何想法嗎?

您應該在plist中提供以下代碼。

  NSAllowArbitraryLoads  boolean  yes

問題來源如下

傳輸安全性已阻止明文HTTP

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

我遇到了同樣的問題,可以通過在工作區中找到所有Info.plist文件並將NSAppTransportSecurity邏輯添加到負責外部( http:// )調用.plist文件的方法來解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM