In need to check if the phone is connected to the internet.
I currently implemented this check as followed:
NSString *connectionString = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:@"http://www.google.com/ncr"] encoding:NSUTF8StringEncoding error:nil];
//If user isn't connected
if ([connectionString length] == 0){
//Do this
} else {
//Do that
}
This check works perfectly on WIFI networks! But as soon as the user is on a 3G / EDGE network the connectionString = null
How can I improve this check, even on 3G networks?
Thanks