How do I load an HTTP URL with App Transport Security enabled in iOS 9?

See Apple’s App Transport Security Technote for full details.
You can add exceptions for specific domains in your Info.plist:

All the keys for each excepted domain are optional. The speaker did not elaborate on any of the keys, but I think they’re all reasonably obvious.
You can also ignore all app transport security restrictions with a single key, if your app has a good reason to do so:

If your app does not have a good reason, you may risk rejection:
Setting NSAllowsArbitraryLoads to true will allow it to work, but Apple was very clear in that they intend to reject apps who use this flag without a specific reason. The main reason to use NSAllowsArbitraryLoads I can think of would be user created content (link sharing, custom web browser, etc). And in this case, Apple still expects you to include exceptions that enforce the ATS for the URLs you are in control of.
If you do need access to specific URLs that are not served over TLS 1.2, you need to write specific exceptions for those domains, not use NSAllowsArbitraryLoads set to yes. You can find more info in the NSURLSesssion WWDC session.
Please be careful in sharing the NSAllowsArbitraryLoads solution. It is not the recommended fix from Apple.

Leave a Comment

Copyright © 2019 Soulmedic Theme All Rights Reserved | Design Themes

Atomic Flavor