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.
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).