0

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

Alex
  • 141
  • 1
  • 1
  • 5

4 Answers4

4

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.

christophercotton
  • 5,829
  • 2
  • 34
  • 49
0

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.

Krip
  • 854
  • 1
  • 7
  • 15
  • It's a apps for my company, and I don't want the people who use it can't quit the application, but I also want to save the state, do you know I to do that? – Alex Jul 01 '10 at 14:32
0

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.

Matt S.
  • 13,305
  • 15
  • 73
  • 129
  • Yes, but's it's for my company.. I don't sell it on the apps store. So what I put in the applicationWillTerminate to don't stop the apps, not juste to delay it. – Alex Jul 01 '10 at 14:31
0

No, this would easily allow a developer to turn an iPhone into a useless brick.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368