Duke Duke - 1 year ago 56
iOS Question

Allow HTTP without disabling ATS in iOS

I am developing an app which have a small tweak in it. it will show a preview of the given url (like Facebook,whatsapp does). but if the "User-given" url is in HTTP, I couldn't load the preview when ATS is turned on. so i turned off the whole HTTPS traffic by using NSAllowsArbitraryLoads . is there any way to allow http with ATS enabled?


You can add exceptions (NSExceptionDomains) to allow HTTP for specific domains. See the documentation.

However, if the user given URL can be any URL, then there is no other way but to use NSAllowsArbitraryLoads.