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 res开发者_如何学Pythonponse 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.
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.
well i bought an iphone- and the code works with the iphone-
it is simply ignored on an ipod touch-
cheers
精彩评论