【发布时间】:2011-04-25 16:40:00
【问题描述】:
如果发生错误,将显示UIAlertView。但与此同时,调用UIAlertView 的观点已被驳回(因此被释放)。如果用户单击“确定”,则应用程序崩溃,因为向已发布实例发送了消息。这将导致您的应用崩溃:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"test" message:@"test" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
alertView = nil;
[self.navigationController popViewControllerAnimated:YES];
我认为UIAlertView 是一个独立的单元。但似乎并非如此。有没有办法避免应用程序崩溃(除了不关闭视图)?
【问题讨论】:
标签: iphone cocoa-touch uiviewcontroller uialertview dismiss