UIAlertView
如果发生错误,将显示A。但与此同时,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
是一个独立的单位。但似乎并非如此。有没有办法避免应用程序崩溃(除了不关闭视图)?