Weird IF THAN not working with Requested data from URL text problem

Posted by StealthRT on Stack Overflow See other posts from Stack Overflow or by StealthRT
Published on 2010-04-10T05:11:52Z Indexed on 2010/04/10 5:13 UTC
Read the original article Hit count: 201

Filed under:

Hey all, i am checking for an internet connection by checking for a file on my server. The file only has the word LIVE displayed on the page. No HTML or anything else is there, just the word LIVE.

When i run this code, i do get the NSLog as saying "LIVE" but once i go to check it with the IF statement, it fails and i just do not know why???

NSString* myFile = [NSString stringWithFormat:@"http://www.xxx.com/iPodTouchPing.html"];
NSString* myFileURLString = [myFile stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSData *myFileData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:myFileURLString]];
NSString *returnedMyFileContents=[[[NSString alloc] initWithData:myFileData encoding:NSASCIIStringEncoding] autorelease];

NSLog(@"%@", connected);

if (connected == @"LIVE") {
 ...

What am i doing wrong? I can not seem to find the reason??

David

© Stack Overflow or respective owner

Related posts about iphone-sdk