Im using Reachability to check the network status for my app, everithing works OK except that in iOS 9.0.1 or higher the reachableBlock
and unreachableBlock
are called twice, which takes me into a big trouble.
This is only happening in iOS 9.0.1 and iOS 9.1 Beta.
And heres an example of my code:
-(void)checkServerConnection{
//This nslog is to check the method is called only once.
NSLog(@"Check Server Connection");
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
[reach startNotifier];
reach.reachableBlock = ^(Reachability*reach)
{
//This NSLOG is called twice
NSLog(@"Reachability reachable block");
dispatch_async(dispatch_get_main_queue(), ^{
//This NSLOG is called twice
NSLog(@"REACHABLE!");
});
};
reach.unreachableBlock = ^(Reachability*reach)
{
//Same story for this one..
NSLog(@"UNREACHABLE!");
}
}
Please if someone have solved this issue let me know how.