I am trying to get the url source so that I can parse the HTML to get the info. I have the following code:
NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSError *err = nil; NSString *urlContents = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&err]; if(err){ NSLog(@"err %@",err); } NSLog(@"urlContents %@", urlContents);
This code works fine on the simulator, but on the device I get the following error:
err Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn't be completed. (Cocoa error 256.)" UserInfo=0x167150 {NSURL=http:
source share