In a iphone apps, is it possible to stop the user when he want the quit the application with the home button, so, the user can't quit the application and I close the application when it's the time?
thanks Alex
In a iphone apps, is it possible to stop the user when he want the quit the application with the home button, so, the user can't quit the application and I close the application when it's the time?
thanks Alex
You can't prevent the user from quitting. If you try to prevent it, the OS will terminate the app directly. With iOS 4.0, you can have tasks that are allowed to complete in the background. Check out: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html
For an overview about running tasks.
Do you want to save state? You are allowed to run code on application exit, to save your state so that you can restore it when app is next launched. I know apps that do this.
In applicationWillTerminate
(or whatever it's called, I forget), you could put some stuff in there that will delay it, but I'm not sure if SpringBoard will terminate it. Plus it'll provide a terrible UX (User eXperience). If I downloaded an app that did that, I would delete it off my device faster then a pug running for food.
No, this would easily allow a developer to turn an iPhone into a useless brick.