Reputation: 21254
I need to stop in some situation an application from remaining in background: how to stop MPMoviePlayerViewController from downloading video if the app is in background
I don't want to disable the multitasking, but in some situation I need to close the app
exit(0)
works perfectly, but is this approvable by Apple?
exit(0)
doesn't create any user-experience problems, because it happens in background and the user doesn't see anything.
Does anyone know any other alternatives?
Thanks in Advance!
Upvotes: 0
Views: 672
Reputation: 8513
Looks perfectly acceptable to me. Not much difference between exit (0) and the kill -KILL of a memory warning. Provided you restore the UI to a reasonably consistent state after startup.
Of course, AppStore police might have different opinions...
Upvotes: 1
Reputation: 36617
No, that's not allowed and you should give the user full control when to exit your app.
Don’t Quit Programmatically
Never quit an iOS application programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your application from functioning as intended, you need to tell your users about the situation and explain what they can do about it. Depending on how severe the application malfunction is, you have two choices.
Display an attractive screen that describes the problem and suggests a correction. A screen provides feedback that reassures users that there’s nothing wrong with your application. It puts users in control, letting them decide whether they want to take corrective action and continue using your application or press the Home button and open a different application
If only some of your application's features are not working, display either a screen or an alert when people activate the feature. Display the alert only when people try to access the feature that isn’t functioning.
Upvotes: 3