Why are my "tel:" links not working
Posted
by Griffo
on Stack Overflow
See other posts from Stack Overflow
or by Griffo
Published on 2010-03-08T01:37:11Z
Indexed on
2010/03/08
1:40 UTC
Read the original article
Hit count: 497
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
© Stack Overflow or respective owner