IOS 7中的后台任务间隔期 [英] background task interval period in IOS 7
问题描述
我在appdidEnterBackground()中有以下代码,我看到在IOS 6中我看到后台时间约为10分钟,而IOS 7中的相同代码打印2分钟。
I Have the following code in the appdidEnterBackground() and I see that in IOS 6 I see that the background time period is approx 10 mins and the same code in IOS 7 is printing 2 mins.
以下是代码:
-(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);
});
}
问题是:如何将我的背景时间从2分钟增加到约2分钟在IOS 7中10分钟?我有什么遗漏吗?
Question is: How can I increase my background time period from 2 mins to approx 10 mins in IOS 7? Is there anything I am missing?
推荐答案
阅读iOS 7发行说明。这是新行为。你不能
改变它。 ( rmaddy )
正好是180s所以3分钟(而不是2分钟):)( Gros )
注意
为了维持秩序,我按照这个问题的答案:
(标记为社区维基)
Note
For the sake of maintaining order, I followed the answer for this question: What to do with questions that have been self-resolved as a comment instead of an answer?
(marked as community wiki)
这篇关于IOS 7中的后台任务间隔期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!