UIAlertview代码= 1上的EXC_BAD_ACCESS [英] EXC_BAD_ACCESS on UIAlertview code=1
本文介绍了UIAlertview代码= 1上的EXC_BAD_ACCESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在[alert show]行上获得了EXC_BAD_ACCESS.
I am getting the EXC_BAD_ACCESS on [alert show] line.
我为什么要得到这个?
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
推荐答案
只需将委托设置为nil,不要将self应用于委托.请按如下所示对其进行编码
Just make delegate nil ,don't apply self to delegate .code it like below
alert = [[UIAlertView alloc]initWithTitle:@"Application Alert" message:@"all date popup" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Update",nil];
[alert show];
如果您在委托中使用self,则必须使用警报委托方法
if you are using self in delegate then you will have to use alert delegate method
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
然后它将不会给出EXC_Bad_Excess.让我知道它是否有效.. !!!!快乐的编码....
then it will not give EXC_Bad_Excess.let me know if it works..!!!!happy coding....
这篇关于UIAlertview代码= 1上的EXC_BAD_ACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文