I have internet connection and can browsing with browser.
Here is my codes to check Reachability
with AFNetworking
.
- (BOOL)connected {
return [AFNetworkReachabilityManager sharedManager].reachable;
}
And In ViewDidLoad
BOOL isOnline = [self connected];
if(isOnline == YES)
{
NSLog(@"YES");
}
else
{
NSLog(@"NO");
}
It's only showing NO
and i don't know why is it?
Is there easiest way to check Reachability
with AFNetworking
?
I guess startMonitoring
isn't called, try to do the below:
- (void)viewDidLoad {
[super viewDidLoad];
....
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
}