Can't endBackgroundTask: no background task exists with identifier, or it may have already been ended

前端 未结 9 850
时光说笑
时光说笑 2020-11-27 02:42

I am using background task to run the timer in the background to update the user\'s location. It\'s declared as:

UIBackgroundTaskIdentifier bgTask;
         


        
9条回答
  •  不知归路
    2020-11-27 03:19

    Reproduced, here is my entire app:

    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate
    {
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
        {
            return true
        }
    }
    

    And when I take it to background I get the same message. No storyboard or any other noise.

提交回复
热议问题