Hi everyone, I am trying to read a file on the Internet that says “this is a test” and I want to compare it ... so this is what I got:
NSError *error;
NSURL *theURL = [NSURL URLWithString:@"http://mysite.com/test.asp"];
NSString *test = [NSString stringWithContentsOfURL:theURL encoding:NSASCIIStringEncoding error:&error];
NSLog(@"%@",test);
if(test == "this is a test"){
NSLog(@"File read");
} else {
NSLog(@"Bad file");
}
What am I doing wrong here? I always get a Bad File, but I know that it pulls the text. Thank you all
Damien
source
share