Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS is exit(0) deprecated?

Tags:

ios

iphone

Does anyone know if exit(0) is deprecated in iOS application? I know it is not a good decision to manually terminate the app, but does Apple ban the application if we use it in the code?

like image 864
user1898387 Avatar asked Dec 12 '12 16:12

user1898387


2 Answers

I got an app which was rejected because of a way of exit (via UIAlertView), doing an exit(5) when user click on the correct button.

I received that:

We found that your app includes a UI control for quitting the app. This is not in compliance with the iOS Human Interface Guidelines, as required by the App Store Review Guidelines.

Please refer to the attached screenshot/s for reference.

The iOS Human Interface Guidelines specify,

"Always Be Prepared to Stop iOS applications stop when people press the Home button to open a different application or use a device feature, such as the phone. In particular, people don’t tap an application close button or select Quit from a menu. To provide a good stopping experience, an iOS application should:

  • Save user data as soon as possible and as often as reasonable because an exit or terminate notification can arrive at any time.

  • Save the current state when stopping, at the finest level of detail possible so that people don’t lose their context when they start the application again. For example, if your app displays scrolling data, save the current scroll position."

It would be appropriate to remove any mechanisms for quitting your app.

A "hidden" exit could be understood as a crash for the user, no?

like image 78
Larme Avatar answered Oct 04 '22 03:10

Larme


No, Apple will not reject your app for using exit(0).

You are correct, it is not a great design choice, but it can be useful sometimes.

As Larme mentioned, if used incorrectly, it can be perceived as a crash and a crash will result in your app being rejected.

However, it can be very useful in applicationDidEnterBackground when (on a conditional basis ) you might want to force the app to start a fresh.

like image 28
Jason Whitehorn Avatar answered Oct 04 '22 03:10

Jason Whitehorn