views:

471

answers:

3

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.

A: 

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

Can the iPhone Simulator support phone calls? Open up Mobile Safari and see if you can use it to simulate calls. I would imagine you can't get the prompt to display on the iPod Touch as it's an iPod and not an iPhone.

taspeotis
Thanks for your reply-There are various apps that i have downloaded from the app store that dial a number when you press the dial button- they work on the iphone, but on the ipod touch it spits out the following error in a UIAlertView-"Unsupported URLThis URL wasn't loaded: tel://99887766"I can't get the simulator or the touch to give that message- its almost like my dialing code is simply passed over-cheers, dave.
dave
A: 

well i bought an iphone- and the code works with the iphone-

it is simply ignored on an ipod touch-

cheers

dave
A: 

OMG Please say it isn't so

anonymous