0

Possible Duplicate:
Proper way to exit iPhone application?

There are some similar questions but my question has its own significance.

In my application there are some forms and confirmation button.

When user press confirmation at last form i.e. nib file a message (UIAlertView) is shown saying you have confirmed your order.

Then I want my application to quit. How can i accomplish this?

UPDATE:

In my application i have confirmation form.

When somebody click confirm button i have shown UI Alert button saying your order is confirmed.

Because i cant exit application (Apple does not recommend that) i want to show it another view i.e. nib file having label telling user to press home button.

But i have UI Alert view as well which tells success and failure of confirmation dispatch to database.

So how can i accomplish whole process?

Community
  • 1
  • 1
Mann
  • 5,477
  • 6
  • 45
  • 57
  • 2
    Why does this question have "its own significance" even though you admit there are other similar questions? What makes it different than, eg, [Proper way to exit iPhone application?](http://stackoverflow.com/questions/355168/proper-way-to-exit-iphone-application) – eldarerathis Aug 12 '11 at 14:39

4 Answers4

2

You can use the c function call abort() to accomplish this.

I strongly suggest that you reread the HIG though, especially if you're planning to release this to the public.

You can find it here.

Hyperbole
  • 3,917
  • 4
  • 35
  • 54
  • You mean your new question. Why not link the new view creation to the success/failure reporting of the UIAlertView? – Hyperbole Aug 12 '11 at 16:16
1

You cannot do that. Self-terminating apps violate Apple's guidelines. See here.

Nathanial Woolls
  • 5,231
  • 24
  • 32
1

Simple answer: You should not. There is no correct way to do this and apple wont allow such an app on the appstore.

If you had to and wanted to publish the app in Cydia or only use it for your self, you could call an undefined method, which would crash the app.

'[self undefinedMethodName];'

Or call 'exit(0);'

Dont do it.

SideSwipe
  • 559
  • 3
  • 15
1

You should not do that. Apple advises that whenever your app must terminate, you should prompt the user to press the home button. If you feel like you want to ignore the rules, use abort().

Moshe
  • 57,511
  • 78
  • 272
  • 425