0
在我在的appDelegate的.mi有插入像苹果的可达性代码的应用程序说:可达块应用
-(BOOL)checkInternet
{
Reachability *r = [Reachability reachabilityWithHostName:@"google.com"];
NetworkStatus internetStatus = [r currentReachabilityStatus];
BOOL internet;
if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) {
internet = NO;
} else {
internet = YES;
}
return internet;
}
,并在我的方法viewcontroller.m - (空)applicationDidBecomeActive:(UIApplication的*)应用程序{
gotInternet = [self checkInternet];
if (gotInternet == 0)
{
//No connection
} else {
//Connection ok
}
但是当网络出现问题时3g我的应用程序在大约20秒后因为等待时间过长而崩溃。我如何异步实现控制连接,永远不要看门狗?
感谢