Exit iphone Application

2019-08-29 06:15发布

问题:

Is it possible to use objective c to signal for application to close?

Regards,

Toby

回答1:

Previous commenter is right, but there may be cases where you want a "quit" button in your app. Just call exit(0) to quit the app.



回答2:

You're not supposed to close an iPhone application. You're supposed to wait for the OS to signal to you that the user has gone elsewhere. Read the Human Interface Guidelines.



回答3:

On the iPhone, apps do not quit unless the user touches the Home button on the phone.

So even if there is some valid reason that your app cannot continue, you should not quit. Just put up an alert explaining why you can't do anything - e.g. "Sorry, this application needs to be connected to the internet. Please try again when you have coverage."

Then the user can read the alert, and press the home button to quit in the usual way. If the application quits on its own, it looks as though it has crashed.



回答4:

Having your application quit on its own or through user input on the screen is strongly discouraged by Apple. As it has been mentioned you can use exit(0) to force it, but if your app is headed for the App store expect a rejection. I'm not sure on the process of enterprise distribution of iPhone applications so I don't know what issues would occur there.