Raise exception on App Transport Security?

让人想犯罪 __ 提交于 2019-12-18 05:21:39

问题


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?


回答1:


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.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!