I am using background task inside my app after updating my iPad to iOS 13 my application issuing this:
Can't end BackgroundTask: no background task exists with identifier > 13 (0xd), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
I debugged with UIApplicationEndBackgroundTaskError() but didn't get any result and I have tested my on iOS 12 and other previous versions it worked perfectly.
You need to set bgTask = UIBackgroundTaskInvalid
in two moments
In the expiration handler. After finishing your task.
I believe you are missing any of those two moments and that is why you are getting that error.
See apple example code:
}