Tag: 中止

用UIAlertView以编程方式退出iOS应用程序

我通过下面的方法中止我的iOS应用程序 -(void)cancelSelected { UIAlertView * alert = [[UIAlertView alloc] initWithTitle:nil message:@"Are you sure you want to exit?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil]; [alert show]; alert = nil; } 方法1: -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex) abort(); } 方法2: -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex) [NSException raise:@"Disagree terms and conditions." format:@"Quit, Cancel"]; } 我应该这样做以编程方式退出我的iOS应用程序? 这个abort()方法会导致拒绝我的应用程序吗? 谢谢!