I want to use a proxy server when opening a url connection with objective-c.But I don't want to use any frameworks other than MKNetworkKit(a third party framework) in my project.Can anyone tell me how to accomplish this?
Asked
Active
Viewed 1,013 times
1 Answers
1
MKNetworkKit has no special support for HTTP proxies, but, because it uses NSURLConnection
and NSURLRequest
, you can add proxy support as described in this answer: How to add a proxy to NSURLRequest
.
In short:
- Implement a custom
NSURLProtocol
that adds your proxy information to the request - Register your protocol with the URL loading system (
+[NSURLProtocol registerClass:]
) - Use MKNetworkKit as you normally would to load URLs with your custom protocol
Of course, it might be simpler just to use CFNetwork directly.