Llg Llg - 18 days ago 6
iOS Question

iOS 10: HTTP connection is not allowed

Trying to connected my swift application to the server in order to get the data, I got this error when I tested the app in the simulator and the device having iOS 10:

subsystem: com.apple.libsqlite3, category: logging, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0

and also this:

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.

I was first thinking that the problem is with the

http://
so I added this to my info.plist:

<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>


But It has no effect at all for the iOS 10 (I don't know about the iOS 9 because I didn't tested it).

Note that my application works perfectly with iOS 8. I'm using Xcode 8 and swift 3.

Answer

You have to replace

<key>yourdomain.com</key>

with your own domain, and without 'http://'

Comments