Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can someone guide me as to how can I make an application quit when you press the cancel button of an Alert View in C# code?


I forgot to add that I am trying to quit application on clicking ok button on alert view which I am developing on Unity platform.

share|improve this question
Why the objective-c tag, are you trying to quit an iOS app? You can't do that. – Tetrad Mar 12 '13 at 20:26
What is your exact software stack? And why is the task causing issues? – aaaaaaaaaaaa Mar 12 '13 at 21:26
Do you want a solution in C# or in UnityScript? Your tags are pretty weird – Max Mar 14 '13 at 16:33

You're not supposed to programmatically quit iOS apps.

Don’t Quit Programmatically

Never quit an iOS app programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your app 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 app 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 app. It puts users in control, letting them decide whether they want to take corrective action and continue using your app or press the Home button and open a different app

If only some of your app's features are unavailable, display either a screen or an alert when people use the feature. Display the alert only when people try to access the feature that isn’t functioning.


That being said, you can call exit(0) but it's highly not recommended.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.