0

I am writing a really simple app which should be quick to use. I therefore want to have a button that performs a function then causes the app to exit once this function is done.

Firstly is this ok with Apple's rules, the area seems a little grey. And secondly if this is ok what code should I use? I've tried

[[UIApplication sharedApplication] terminateWithSuccess];

which does exit the app but I have data which needs saving on the way and this function never gets called...

-(void)applicationWillTerminate:(NSNotification *)notification

Any tips would be great.

user157733
  • 569
  • 2
  • 12
  • 26

2 Answers2

2

This area is not a "little grey". It's explicitly prohibited to quit an app programmatically.

Also, terminateWithSuccess is a private API, so this is clearly prohibited.

gcamp
  • 14,622
  • 4
  • 54
  • 85
2

Your question is a dupe of this question:

Proper way to exit iPhone application?

Apple wants the user to do the quitting via the home button (look at the highly voted answer on that linked question).

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215