I\'ve incorporated Apple\'s Reachability sample into my own project so I know whether or not I have a network connection - if I don\'t have a network connection, I don\'t bother
There is a nice reachability example on the net. it works wonderfully well: http://servin.com/iphone/iPhone-Network-Status.html
But you see, when I try to use it my own way, it just bombs.
Tried to implement it using:
NSString *sCellNetwork;
NSString *sNetworkReachable;
if (flags & kSCNetworkFlagsReachable || flags & kSCNetworkReachabilityFlagsIsWWAN)
{do it}
else {
Network fail alert;
}
Reachability notificataions didn't seem to be reliable for me either, for detecting Wi-Fi. So I just use polling instead. Checking every 5 seconds seems to do no harm.
- (void) checkReachability {
BOOL connected = ([[Reachability sharedReachability] localWiFiConnectionStatus] == ReachableViaWiFiNetwork);
// Do something...
[self performSelector:@selector(checkReachability) withObject:nil afterDelay:5.0];
}