sslnsurlconnectioncertificate-pinning

NSURLConnection sendSynchronousRequest + SSL Pinning


Is there a way to implement SSL pinning when using [NSURLConnection sendSynchronousRequest: returningResponse: error:] method?


Solution

  • No. That method has almost zero configurability, because it does not support delegate callbacks. The closest you could get would be writing a wrapper around NSURLSession using semaphores or similar to synchronously wait for completions.

    That said, it is usually easier to just rewrite the code to do things asynchronously that to try to force your networking code into a synchronous environment.