I get an error with the following code. Essentially the app confirms calling the number when it is selected from the table view. The EXC_BAD_ACCESS is coming in when the ViewContoller with this alert is dismissed.
It only happens if the alert is triggered. It does not if the table is only viewed with no selection. That tells me I am doing something wrong with this UIAlertView. Probably having to do with memory management and releasing something I should not be.
Where am I going wrong?
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];
}