TonyNeallon
TonyNeallon

Reputation: 6607

Exit iphone Application

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

Regards,

Toby

Upvotes: 0

Views: 4465

Answers (4)

Covar
Covar

Reputation: 900

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.

Upvotes: 0

Jane Sales
Jane Sales

Reputation: 13546

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.

Upvotes: 2

Daniel
Daniel

Reputation:

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.

Upvotes: 0

Paul Tomblin
Paul Tomblin

Reputation: 182870

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.

Upvotes: 6

Related Questions