iOS 9 App transport security
Closed this issue · 4 comments
Hi;
I could not get it work with iOS 9. It was working fine when I was compiling with base iOS 8. But the new security changes for iOS 9 has broken my current implementation.
When I tried to open a page it gives the error below.
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've added the property below to my plist file it also didn't help.
<key>NSAllowArbitraryLoads</key>
<true/>
Do you have any idea about this problem?
Hi!
I had this same issue in my app and this web view controller. Unfortunately, if you're intending to load any HTTP based websites in your app, there's not a lot we can do to play nicely with ATS here. :/
If you're using the web view controller to load specific sites (for example, I'm only using this controller to load pages from my blog in my app), you can 'white-list' those in ATS. That being said, doing that can be tedious, especially if the web page you load in also links to external content (e.g., my blog links to Google Fonts)
Apart from that, like you're doing there, I just flat-out disabled ATS in my app. Your plist code there looks correct, but you may be forgetting to include it inside a NSAppTransportSecurity
dictionary:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
I hope that helped! Good luck!
Thanks for the answer.
I'm using web view controller to load a lot of different sites and they can change dynamically. So white-listing is not an option. My plist file is also good.
So I think I'm stuck with [UIApplication sharedApplication] openURL
My bad!
As you can see in the above code I wrote NSAllowArbitraryLoads
instead NSAllowsArbitraryLoads
. I have forgotten to write s of allows.
Now it's working fine.
Oh blimey. I completely missed that. XD
No worries! Glad to hear you got it working! :)