如何在xcode ios中为ASIHTTPRequest设置socks代理?

时间:2012-04-03 10:06:28

标签: ios xcode uiwebview asihttprequest socks

我希望UIWebView通过socks代理传输所有数据我已经为ASIHTTPRequest设置了代理URL,端口,用户名和密码,但它不起作用,我不想使用pac文件。

$ - (IBAction)Go:(id)sender {

NSURL *url = [NSURL URLWithString:[TextURL.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

ASIHTTPRequest *request1 = [ASIHTTPRequest requestWithURL:url];

 [request1 setProxyHost:@"test.org"];
 [request1 setProxyPort:808];

 [request1 setUsername:@"user"];
 [request1 setPassword:@"password"];

[request1 setDelegate:self];
[request1 startAsynchronous];
[TextURL resignFirstResponder];

}

$ - (void)requestFinished:(ASIHTTPRequest *)request {

NSData *responseData = [request responseData];
NSError *error = [request error];
if (!error) {
    [web1 loadData:responseData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[request url]];
}

}

0 个答案:

没有答案