-7

Possible Duplicate:
Proper way to exit iPhone application?

How can I Crash my app?

i want To crash the app if the user press close in this code

    UIAlertView *alertView = [[UIAlertView alloc] 
                              initWithTitle:@"Alert!" 
                              message:@"What To Do To You App!" 
                              delegate:self 
                              cancelButtonTitle:@"Close"
                              otherButtonTitles:@"Open In Safari",nil];



- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 1)
{
    NSLog(@"Open in Safari");
}
else
{
    NSLog(@"Close");
}
}
Community
  • 1
  • 1
Youstanzr
  • 605
  • 1
  • 8
  • 16

3 Answers3

4

What about doing a divide by zero near to the code!

Yasser Zamani
  • 2,380
  • 21
  • 18
3

Use-

[[NSThread mainThread] exit];
rishi
  • 11,779
  • 4
  • 40
  • 59
2

You should NOT add a button to close/quit your app on iOS.

pre
  • 3,475
  • 2
  • 28
  • 43