views:

84

answers:

1

I am using the following code to fetch the contents of a web page but it needs to follow all the network rules etc as defined in the user's system prefs

 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];

Specifically, does stringWithContentsOfURL connect using the system wide proxy settings? (if there are any defined)

+1  A: 

I just did some tcpdumps between Safari and an Obj-C program using stringWithContentsOfURL. Safari respected my proxy while stringWithContentsOfURL did not.

nall
Hmmm, do you know of an alternative to stringWithContentsOfURL that doesn't use event functions?Thanks :)
Cal S
Look into the NSURLConnections sendSynchronousRequest method.
nall