Hi I am using Reachability to detect wether my application is online or offline. I want to implement that, while running and suddenly my internet connection lost then i want to show al alert.
I tried with following code to do the same:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityDidChange:) name:kReachabilityChangedNotification object:nil];
- (void)reachabilityDidChange:(NSNotification *)notification {
// Reachability *reachability = (Reachability *)[notification object];
Reachability *reachability = [Reachability reachabilityForInternetConnection];
[reachability startNotifier];
if (reachability == ReachableViaWiFi) {
NSLog(@"Reachable");
} else {
NSLog(@"Unreachable");
}
}