我收到以下代碼的錯誤消息。本質上,應用程序確認在從表格視圖中選擇時調用該號碼。當具有此警報的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