Can't end BackgroundTask

Every time I put my app into the background, I get the following error:


Can't end BackgroundTask: no background task exists with identifier 28 (0x1c), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.


This leads to remote notifications not being handled by my app while it's in the background. I don't use background tasks anywhere, and when I add a symbolic breakpoint on UIApplicationEndBackgroundTaskError, I get nothing useful in the stack trace. It simply breaks at the declaration of the AppDelegate class.


Any reason this might be happening? It's only started happening recently, so I'm wondering if it's related to iOS 13 or Xcode 11.

Replies

It's happening to me and others as well. Looks like it may be an issue with iOS 13 since it occurs even on a blank project whether you're using a simulated device or physical device. There's some discussion (but no resolution) on this thread here https://forums.developer.apple.com/thread/121990