How do I handle force quit in Swift? I received crash reports during a tesflight test. I didn't understand what it was: none of my app's symbols were present, and Xcode didn't want them either... unlike two others who were very specific.
By doing a few Google queries, I saw that [UIApplication _terminateWithStatus:] + 136 (UIApplication.m:7578). Accompanied by a SIGSEV... corresponded to a simple thing: it's a crash during a force quit.
I tested it with two iPhones, connected to my Mac, and launched the app from Xcode on each of them. I waited a bit, then quit it. It immediately went into the background and waited to launch operations with BackgroundTaskManager. I went to the app carousel and quit it with a swipe of my finger. I immediately see in the log that "sceneDidDisconnect" from SceneDelegate is called... then the immediate crash occurs, with the same elements as those received during the test flight
: SIGSEV and [UIApplication _terminateWithStatus:] and identical elements thereafter.And this applies regardless of what I put in "SceneDidDisconnect," a print, and something to close the BGtasks if they are running (but iOS should normally kill them too, right?) .. 1 or 2 secondes after it crashes.
At the moment of the crash, the Xcode cursor is positioned on "class Appdelegate" in AppDelegate.
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
My question is: how do I handle force quit in Swift? I have another Objective-C application that does the same thing and runs identical operations in the background. If I force quit it, there is no crash.