I'm trying to debug an app that makes a lot of HTTP calls. I'm seeing this in the console:
2015-09-08 17:21:01.458 MyApp[3186:3064431] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
I understand how to add exceptions to my plist, but is there way to add a breakpoint where these requests are failing to see what is being requested?
I wasn't able to make much of the stack trace when adding those breakpoints; however, this blog post helped me figure out which domains were failing:
http://timekl.com/blog/2015/08/21/shipping-an-app-with-app-transport-security/
tl;dr: set the environment variable CFNETWORK_DIAGNOSTICS to 1 (how to set environment variables, if you need a hand: http://nshipster.com/launch-arguments-and-environment-variables/). this will log all the CFNetwork activity to a file that you'll see in the console; search that file for 'Did Fail' and you can see which requests are failing and why.
Try adding a symbolic breakpoint in HTTPProtocol::failWithStreamError
and/or StrictSecurityPolicy::logInsecureLoadFailure
.
(This unfortunately may not make it easy to get the stack trace of the actual request, since this exception occurs asynchronously with the actual request creation code. But it might help you anyway.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With