Under iOS 9, I've used the accepted answer here: Transport security has blocked a cleartext HTTP
I added the entries to my Info.plist file under NSAppTransportSecurity
. My app seems to be functioning properly, as well as executing all of the requests for which I've accounted for. I am still receiving the error:
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.
My problem is that I can't find where in my app codebase this is coming from and I do NOT want to allow all domains (lazy option referenced in the accepted answer I credited). Is there a way to raise an exception for it so that I can find the source of the warning?
Using this link (http://timekl.com/blog/2015/08/21/shipping-an-app-with-app-transport-security/) from the comment above, I found that switching the environment variable CFNETWORK_DIAGNOSTICS
to 1
produces a detailed log of all the requests.
This allowed me to trace the requests coming from a webView where I'm loading my own domain, which in turn loads things like MixPanel and Google Analytics. Entering those domains into the Info.plist file fixes the issue, however, we're instead simply going to load the https versions of these libraries.
Use an http analyzer such as Charles Proxy (30 day free trial) to find all the URL's being called.
来源:https://stackoverflow.com/questions/32993320/raise-exception-on-app-transport-security