【发布时间】:2013-02-11 08:27:44
【问题描述】:
我有这段简单的代码:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Contact" message:@"This contact does not exist yet" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:@"Not now", nil];
[alert show];
如果我将委托设置为“nil”,一切都很好。但是,如果我将委托设置为“self”并添加 clickedButtonAtIndex 或 didDismissWithButtonIndex 委托,则应用程序会因 EXC_BAD_ACCESS 而崩溃
【问题讨论】:
-
你把
放在你的 .h 中了吗? -
请检查你的.h文件你有#import
-
是的,在标题中有
-
您的应用程序何时崩溃?显示还是点击?
-
当我点击任一按钮时
标签: xcode crash uialertview exc-bad-access