我在appdidEnterBackground()中有以下代码,我看到在IOS 6中,背景时间周期大约是10分钟,而IOS 7中的相同代码是打印2分钟。
下面是代码:
-(void)applicationDidEnterBackground:(UIApplication *)application
{
backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:backgroundTaskIdentifier];
backgroundTaskIdentifier = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSTimeInterval timeInterval = [[UIApplication sharedApplication] backgroundTimeRemaining];
NSLog(@" time remaining in background = %f",timeInterval);
});
}问题是:如何在IOS 7中将背景时间从2分钟增加到大约10分钟?我遗漏了什么吗?
发布于 2014-02-06 07:08:21
阅读iOS 7发行说明。这就是新的行为。你不能改变它。(rmaddy)正是180分钟,所以3分钟(而不是2分钟) :) (Gros)
Note
为了维持秩序,我遵循了这个问题的答案:What to do with questions that have been self-resolved as a comment instead of an answer? (标记为社区wiki)
https://stackoverflow.com/questions/18815384
复制相似问题