【发布时间】:2012-05-20 21:21:11
【问题描述】:
如何使我的应用崩溃?
如果用户在此代码中按下关闭,我想使应用程序崩溃
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");
}
}
【问题讨论】:
-
故意崩溃的方法有无数种。在此处查看有关崩溃的任何问题以获取有用的示例代码。
-
最简单的一个:
int hellYeah = 1/0; -
它只是让应用程序崩溃,因为应用程序不是官方版本
-
这是代码thnx [[NSThread mainThread] exit];