3分钟后,后台执行将自动停止 [英] Background execution automatically stops after 3 minutes
本文介绍了3分钟后,后台执行将自动停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将照片上传为后台任务,但是后台执行会在3分钟后自动停止.
I wanted upload photos as background task but background execution stops automatically after 3 minutes.
我完成的代码:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication *app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
//Stop upload call
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
}}
推荐答案
我发现iOS严格限制了运行时间.具体来说:
I found that iOS puts strict limits on how long you can run. Specifically:
从前景移到背景时,当前限制为3分钟. 当您在后台恢复时,限制为30秒.
When you move from the foreground to the background, the limit is currently 3 minutes. When you are resumed in the background, the limit is 30 seconds.
链接推介: https://krumelur.我/2015/11/25/ios-background-transfer-what-about-uploads/
感谢@feroz提供链接.
Thanks @feroz for providing the link.
这篇关于3分钟后,后台执行将自动停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文