dialing on iphone/ipod touch not working with documented procedures

Posted by dave on Stack Overflow See other posts from Stack Overflow or by dave
Published on 2010-01-28T01:49:09Z Indexed on 2010/03/13 21:25 UTC
Read the original article Hit count: 354

I'm trying to set up an iphone app to the phone number of a various sports store using the tel:// url passing method-

I am developing on an ipod touch- usually on the touch you see the error message "Unsupported URL - This URL wasn't loaded tel://99887766" when you try and dial a number. I cant get this message to appear on the simulator or the ipod touch.

do I need to do some sort of fancy signing before the app will dial properly?

I am using this code:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", [selectedBar phoneNumber]]]];

and I've tried adding the slashes:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", [selectedBar phoneNumber]]]];

but neither work.

I have also tried this way:

[[UIApplication application] openURL:[NSURL URLWithString:@"tel://99887766"]];

and this way:

NSMutableString *phone = [[@"+ 12 34 567 89 01" mutableCopy] autorelease];
[phone replaceOccurrencesOfString:@" " 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@"(" 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@")" 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phone]];
[[UIApplication sharedApplication] openURL:url];

No matter what i do i can't get any response from the simulator / ipod touch that it is dealing with a phone number-

When I press the button associated with this code, it doesnt crash, it's like its processed it and decided not to do anything. i even put an NSLog(@"button called"); in just before the code to confirm the button was working, which it is.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-simulator