Version 1.1, 2014-08-20
Changed the protocol to use NSURLSession for its recursive requests. This works around a deadlock issue (r. 17342579) and makes the code more future proof. There were also numerous other minor changes.
(Full Revision History)
Xcode 5.1.1, iOS 7.1 SDK
iOS 7.0 or later
CustomHTTPProtocol shows how to use an NSURLProtocol subclass to intercept the NSURLConnections made by a high-level subsystem that does not otherwise expose its network connections. In this specific case, it intercepts the HTTPS requests made by a web view and overrides server trust evaluation, allowing you to browse a site whose certificate is not trusted by default.