[iOS] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.

If you try to make HTTP requests with ATS enabled (using NSURLSession or libraries like AFNetworking), you’ll see errors like this.

Here’s how to disable ATS entirely. Open Info.plist, and add the following lines:

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

You have to add just the NSAllowsArbitraryLoads key to YES in NSAppTransportSecurity dictionary in your info.plist file.

 

相關文章:

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *