我在 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 分钟?我有什么遗漏的吗?
阅读 iOS 7 发行说明。这是新的行为。你不能
更改。 (rmaddy https://stackoverflow.com/users/1226963/rmaddy)
正好是 180 秒,所以 3 分钟(而不是 2 分钟):) (Gros https://stackoverflow.com/users/428606/gros)
Note
为了维持秩序,我按照这个问题的回答:如何处理以评论而不是答案形式自我解决的问题? https://meta.stackexchange.com/questions/117251/what-to-do-with-questions-that-have-been-self-resolved-as-a-comment-instead-of-a(标记为社区维基)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)