Iphone UIAlertview代码=1上的EXC\u错误\u访问

Iphone UIAlertview代码=1上的EXC\u错误\u访问,iphone,objective-c,xcode,uialertview,exc-bad-access,Iphone,Objective C,Xcode,Uialertview,Exc Bad Access,我正在[alert show]线上获得EXC\u BAD\u访问权限 为什么我会得到这个 alert = [[UIAlertView alloc]initWithTitle:@"Application Alert" message:@"all date popup" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Update",nil]; [alert show]; //EXC_BAD_ACCESS on this line

我正在[alert show]线上获得EXC\u BAD\u访问权限

为什么我会得到这个

 alert = [[UIAlertView alloc]initWithTitle:@"Application Alert" message:@"all date popup" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Update",nil];

 [alert show]; //EXC_BAD_ACCESS on this line

只需将委托设为零,不要将self应用于委托

alert = [[UIAlertView alloc]initWithTitle:@"Application Alert" message:@"all date popup" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Update",nil];

[alert show];
如果在委托中使用self,则必须使用警报委托方法

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

那么它就不会给EXC_Bad_超额。让我知道它是否有效。。!!!!快乐编码…

此崩溃必须在iOS 6上发生。此崩溃的解决方案如下所示:


[alert performSelectorOnMainThread:@selector(show)with object:nil waitUntilDone:YES]

查看我在这里给出的答案[你是从主线程调用它吗?什么是“警报”的原型…我是在主线程中调用它。警报的原型是UIAlertView。@Foram Mukund Shah当你说
主线程完成时有点奇怪,你是什么意思?如果因为你调用
[警报显示]而出错,这是正确的解决方案
从后台下载。