UIAlertView EXC_BAD_ACCESS(代码= EXC_I386_GPFLT)

时间:2015-09-16 13:07:08

标签: ios objective-c

我使用UIAlertView在iPhone6中显示提醒。委托称为nil。当我按下警告的ok按钮时,它会自动崩溃并且没有错误消息。它只显示EXC_BAD_ACCESS(code=EXC_I386_GPFLT)

鉴于代码如下:

UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"" message:@"This First ALert" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show]; 

2 个答案:

答案 0 :(得分:0)

请检查。

UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"" message:@"This First  ALert" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show]; 

谢谢:)

答案 1 :(得分:0)

您刚刚在otherButtonTitles

中添加了额外的nil
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"" message:@"This First ALert" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show]; 

跳这有帮助。