I'm having this really weird issue with Reachability on iOS. If I run my app in debug on a device there's no problem at all, the app runs fine. But when I install it from the store or from TestFlight I get my No Coverage error even if I'm on Wi-Fi, but only when I try to do certain actions. If I don't do that specific action the app runs fine until I do.
This is the part of my code that deals with Reachability:
- (void)connectionReachabilityChanged:(NSNotification *)notice {
NetworkStatus status = [self.connectionReachability currentReachabilityStatus];
if (status == NotReachable) {
self.inCoverage = NO;
} else {
self.inCoverage = YES;
}
}
- (void)hostReachabilityChanged:(NSNotification *)notice {
NetworkStatus status = [self.hostReachability currentReachabilityStatus];
if (status == NotReachable) {
self.inCoverage = NO;
} else {
self.inCoverage = YES;
}
}
- (void)displayAlertOfType:(AlertType)type {
if (type == AlertTypeNoCoverage) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"No coverage"
message: @"You current have no data coverage, try again later"
delegate: self
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[alert show];
}
if (type == AlertTypeOperationNotCompleted) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Whoops... Something went wrong"
message:@"The operation couldn't be completed, try again later"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}