【发布时间】:2010-10-27 15:43:46
【问题描述】:
我收到以下代码错误。本质上,当从表格视图中选择该号码时,该应用程序会确认呼叫该号码。当带有此警报的 ViewContoller 被解除时,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];
}
【问题讨论】:
标签: iphone xcode memory-management uialertview exc-bad-access