In application that I work on it, I need to close it from code. I’m using exit(0) for that.
Yes, I know that i shouldn’t close application from code
When I close application in this way, and run it again, there is some strange behaviur – application doesn’t start nor from splash screen, like new instance of app, neither from last view, like application turning back from background.
Instead, for a second some random, non-interactive view of my app is appearing, and after this splash screen start to run.
I’m confused because I cannot find source, and how to fix this ugly bug. Can you help me?
This is exactly the problem with
exit(0). You get weird multitasking behaviour and all sorts of other problems.You simply can’t terminate your application in code. You should explain to us why you think you need to quit programmatically so we can help you find an alternative solution.