App Transport Security verbose

旧城冷巷雨未停 提交于 2019-12-05 02:53:00

问题


Is there a way to make App transport security more verbose? When my app makes an http call I will get notified in the Xcode console. However it doesn't tell me which http request is triggering the app transport security warning.

Is there a way to make the warning more verbose such that it includes the URL that triggered the warning?


回答1:


You can get this information by bumping up the CFNETWORK_DIAGNOSTICS level

You can set it in your scheme's environment variables like so:

Or you can set it in your code (somewhere like at the beginning of main, for example) or even in your applicationDidFinishLoadingWithOptions. The code to increase the network logging is:

setenv("CFNETWORK_DIAGNOSTICS", "3", 1);

The Xcode console shows the location of the log file:

CFNetwork diagnostics log file created at: /private/var/mobile/Containers/ Data/Application/C1A9DD23-B11E-F39A-E73A-5D837B2B2238/Library/Logs/ CrashReporter/CFNetwork_com.wottle.TestApp_821.nwlrb.log



来源:https://stackoverflow.com/questions/40900357/app-transport-security-verbose

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