2009-10-11 220 views
1

我使用下面的代码来抓取网页的内容,但它需要遵循所有的网络规则等作为用户的系统偏好设定stringWithContentsOfURL使用系统代理设置吗?

NSURL *url = [NSURL URLWithString:@"http://thetalkingcloud.com/static/ping_desktop_app.php?v=1.0"]; 
    NSError *theNetworkError; 
    NSString *content = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&theNetworkError]; 

具体界定,不stringWithContentsOfURL使用全系统的连接代理设置?(如果有任何定义)

回答

1

我只是做了一些tcpdumps之间的Safari和Obj-C程序使用stringWithContentsOfURL。 Safari尊重我的代理,而stringWithContentsOfURL没有。

+0

嗯,你知道一个替代stringWithContentsOfURL不使用事件功能吗? 谢谢:) – 2009-10-11 05:16:23

+0

看看NSURLConnections sendSynchronousRequest方法。 – nall 2009-10-11 06:23:25