我正在使用更新的可达性库来测试互联网连接是否可达。如果无法访问互联网,我会尝试记录一条消息,但日志没有调试:
//Test the internet connection
Reachability* reach = [Reachability reachabilityForInternetConnection];
reach.unreachableBlock = ^(Reachability*reach)
{
NSLog(@"Internet connexion unreachable");//Although Internet cnx is off, this message is not displayed
return;
};
// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
我误解了可达性库吗?互联网关闭时如何执行给定任务?谢谢。
PS:我的iPad只有wifi,没有3G服务。