I encountered this strange behaviour that happens only on iOS.
1. Open game
2. At any point force close it (Swipe up where all the last opened apps are shown, then swipe up on my app to remove it from the list)
3. Then re-enter the game
The game should relaunch normally, starting from the splash screen
I see the last frame before I paused the app before force quitting for about 10 seconds. I think the game settles some undone tasks from the last session, but I cannot be sure.
Then the game acts normally and starts from the splash screen.
If I install from TestFlight, when re-entering the app, it crashes. There is another scenario. If I just force close the app, then wait 10 seconds, I get a crash. Again, this only happens with TestFlight.
It is very similar to this: [Unity 2019.2] iOS build crashes 5 seconds after the application is killed by the user - Questions & Answers - Unity Discussions
Anyway, the workaround with the post build script does not work.
Noteworthy plugins I am using:
Admob (but the problem happened before installing it)
Sprite Skin + Animation 2D (these has caused me many problems, but problem happens even if I force quit in scenes where I don’t use it)
This is what I get when quitting: That Enlighten thread might be the culprit, but I have already disable everything light related.
-> applicationDidEnterBackground() -> applicationWillTerminate() Quitting MainScreenManager:OnApplicationQuit() Setting up 1 worker threads for Enlighten. Thread -> id: 16cbcb000 -> priority: 1 Message from debugger: Terminated due to signal 9
My main questions would be:
1. Why does the app hang on the last frame, even if it has been closed manually by the user?
2. I am not making any web calls in OnApplicationPause. What else could make the app execute some work to be done after force quitting? Already checked my own OnApplicationPause and OnApplicationFocus and they do trivial stuff like removing listeners from a list.
3. I have a threading solution that waits for tasks in an infinite loop on a separate thread. While it has nothing to execute, I do a Monitor.Wait(tasks) inside the infinite loop, so the thread actually sleeps. Could this cause any problems?
Thanks for reading