5

无法结束 BackgroundTask:不存在具有标识符的后台任务,或者它可能已经结束。中断 UIApplicationEndBackgroundTaskError() 进行调试。

self.backgroundTaskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: {
     if self.backgroundTaskIdentifier != UIBackgroundTaskIdentifier.invalid{
                UIApplication.shared.endBackgroundTask(self.backgroundTaskIdentifier!)
                self.backgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid
            }
})
4

0 回答 0