Background execution automatically stops after 3 minutes

帅比萌擦擦* 提交于 2019-12-12 00:45:56

问题


I wanted upload photos as background task but background execution stops automatically after 3 minutes.

Code which I have done:

- (void)applicationDidEnterBackground:(UIApplication *)application
{
   UIApplication *app = [UIApplication sharedApplication];

    bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
    //Stop upload call

    [app endBackgroundTask:bgTask];
    bgTask = UIBackgroundTaskInvalid;
}];
}}

回答1:


I found that iOS puts strict limits on how long you can run. Specifically:

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.

Link referral : https://krumelur.me/2015/11/25/ios-background-transfer-what-about-uploads/

Thanks @feroz for providing the link.



来源:https://stackoverflow.com/questions/37565643/background-execution-automatically-stops-after-3-minutes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!