Hi
I'm trying to run an IF command based on the contents of an NSString from the contents of a URL. My current code is:
However, I always get No returned. Implying that the program can't find the yes printed in the text file. Does anybody know why this is? I thought it might be something to do with the encoding, but I've tried changing the encoding of the text file.
The text file literally says "yes". When you view source in Safari, it literally says "yes".
Thanks,
Sam
I'm trying to run an IF command based on the contents of an NSString from the contents of a URL. My current code is:
Code:
NSError* error1;
NSString *ifYesMessage = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://freedom-apps.com/branon/mac-desktop-pro/file.txt"] encoding:NSASCIIStringEncoding error:&error1];
if (ifYesMessage == @"yes") {
NSLog(@"Yes");
}
else {
NSLog(@"No");
}
However, I always get No returned. Implying that the program can't find the yes printed in the text file. Does anybody know why this is? I thought it might be something to do with the encoding, but I've tried changing the encoding of the text file.
The text file literally says "yes". When you view source in Safari, it literally says "yes".
Thanks,
Sam