gpt4 book ai didi

ios - IOS 7后台任务间隔时间

转载 作者:可可西里 更新时间:2023-11-01 06:10:08 26 4
gpt4 key购买 nike

我在 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 分钟?有什么我想念的吗?

最佳答案

Read the iOS 7 release notes. This is the new behavior. You can't change it. (rmaddy)
It's exactly 180s so 3min (and not 2min) :) (Gros)

注意
为了维护秩序,我按照这个问题的答案:What to do with questions that have been self-resolved as a comment instead of an answer?(标记为社区维基)

关于ios - IOS 7后台任务间隔时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18815384/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com