If the code in any case connects to a web server to try if there's a connection, why not just do this:
Code:
- (BOOL) connectedToNetwork
{
return ([NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.myserver.com/smalltext.txt"]]!=NULL)?YES:NO;
}
This function will return NO if it cannot reach the file. Otherwise, it will return YES. I tried it in flight mode and in 3G mode. It works.