iOS any body knows how to add a proxy to NSURLRequest?

后端 未结 3 1338
忘了有多久
忘了有多久 2020-12-24 09:57

I\'m setting up a webview but I need to load the content of the webview using a proxy. Any of you knows how can I\'m implement the proxy in NSURLRequest?

for example

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-24 10:37

    You cannot add a proxy to NSURLRequest. You will need to use a 3rd party library like ASIHTTPRequest.

    // Configure a proxy server manually
    NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com/ignore"];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setProxyHost:@"192.168.0.1"];
    [request setProxyPort:3128];
    

提交回复
热议问题