Why are my "tel:" links not working
- by Griffo
I have a tableView which has cells with phone numbers. The app is not dialing the numbers though. See the code below
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 2) {
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
NSString *numberToDial = [NSString stringWithFormat:@"tel:%@", selectedCell.detailTextLabel.text];
NSLog(@"%@",numberToDial);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:numberToDial]];
}
}
Console ouput:
2010-03-08 01:32:30.830 AIB[1217:207] tel:01 8350098
As you can see, the number goes to the console, but doesn't get dialled. The weird thing is, if I change the last statement to this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:171"]];
the phone dials the number 171 without any issue