I'm setting "Application does not run in background" to NO
which means, it can go background and resumed later.
I'm putting some code in "applicationDidEnterBackground", and I would like to force quit the app when desirable. (when there's nothing to do in background.)
I read 'exit' is not recommended.
Can I post a message which will result in something like applicationWillTerminate maybe?
Let me clarify why I would want that,
I want my app to run background when it's downloading something.. via beginBackgroundTaskWithExpirationHandler
But if user isn't downloading anything, I can safely quit the application.
Thank you
You don't need to worry about this.
If you have work to do in the background and you set up a background task then it'll run for as long as it needs and execute its handler when done.
What you don't seem to be aware of is that if you have nothing to do in the background, your app is simply suspended and in fact does not run.
As this is the case, there's nothing you need to do, quitting the app won't gain you anything that you don't already get with suspension.