几个小时后,setKeepAliveTimeout突然停了下来

时间:2014-07-21 07:27:14

标签: ios objective-c voip

使用最短600秒的计时器安排setKeepAliveTimeout会使我的应用程序在几小时(6-7)小时内运行良好。

/////////// VOIP HANLDER - BEGIN ///////////
    BOOL handlerAccepted = [[UIApplication sharedApplication] setKeepAliveTimeout:kINTERVAL_10_MINUTES handler:^{        
        CLLocation *currentLocation = [RegionMonitoringService sharedInstance].locationManager.location;

#ifdef DEBUG
        NSString *locationDescription = [NSString stringWithFormat:@"VOIP Location: {%f, %f}, Time: %@",
                                         currentLocation.coordinate.latitude, currentLocation.coordinate.longitude,
                                         [currentLocation.timestamp description]];
        NSLog(@"setKeepAliveTimeout, %@", locationDescription);
        // GeneratePushNotification(locationDescription);
#endif

        [[ServerApiManager sharedInstance] saveLocation:currentLocation];

        // Register a geofence
        [[RegionMonitoringService sharedInstance] startMonitoringForLocation:currentLocation];
    }];

#ifdef DEBUG
    NSLog(@"VOIP handler installed: %@", handlerAccepted?@"YES":@"NO");
#endif
/////////// VOIP HANLDER - END ///////////

在我测试的所有设备中都会发生这种情况。 为什么会这样?

0 个答案:

没有答案