我收到以下代码的错误消息。本质上,应用程序确认在从表格视图中选择时调用该号码。当具有此警报的ViewContoller被取消时,EXC_BAD_ACCESS即将进入。UIAlertView正在导致EXC_BAD_ACCESS
只有在警报被触发时才会发生。如果仅在没有选择的情况下查看表格,则不会发生。这告诉我,我正在做这个UIAlertView错误。可能与内存管理有关并发布我不应该做的事情。
我哪里错了?
phoneAlert = [[[UIAlertView alloc] initWithTitle:locationName message:displayNumber delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Call",nil] autorelease];
[phoneAlert show];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",dialNumber]]];
}
}
- (void)dealloc {
[locations release];
[location release];
[dialNumber release];
[phoneAlert release];
[super dealloc];
}
重复的问题:http://support.microsoft.com/kb/4212580/uialertview-exits-exc-bad-access-error/20058822#20058822 – 2013-11-18 22:06:06