2

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?

Prince Agrawal
  • 3,619
  • 3
  • 26
  • 41
Richard
  • 53
  • 7

1 Answers1

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:

  1. Implement a custom NSURLProtocol that adds your proxy information to the request
  2. Register your protocol with the URL loading system (+[NSURLProtocol registerClass:])
  3. Use MKNetworkKit as you normally would to load URLs with your custom protocol

Of course, it might be simpler just to use CFNetwork directly.

Community
  • 1
  • 1
jonahb
  • 2,570
  • 16
  • 22