Hi There, Is it possible to use objective c to signal for application to close?
Regards,
Toby
Hi There, Is it possible to use objective c to signal for application to close?
Regards,
Toby
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.
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.
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.
What if my app has a major failure and I want to exit it and make the user re-run it later?
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.