我的应用程序的某些用户(在特定运营商上,使用 4g)无法加载照片。
可达性测试也失败了。但是我可以毫无问题地访问我的一些后端 API。
但是,当我使用 WiFi 测试我的应用程序时,这永远不会发生。
什么可能导致这个问题?
可达性测试代码:
- (IBAction)fbButtonPressed:(id)sender {
internetReachableFoo = [Reachability reachabilityWithHostname:@"http://www.google.com"];
// Internet is reachable
__weak id weakSelf = self;
internetReachableFoo.reachableBlock = ^(Reachability*reach)
{
// Update the UI on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf showLoadingIndicators];
[[User sharedInstance] attemptToLoginToFB];
[[Mixpanel sharedInstance] track:@"Try to login using FB"];
});
};
// Internet is not reachable
internetReachableFoo.unreachableBlock = ^(Reachability*reach)
{
// Update the UI on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Network Unavailable"
message:@"Try again when you are connected."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alertView show];
});
};
[internetReachableFoo startNotifier];
}