I'm developing a PhoneGap application, which involves using the native dialer. I'm using this code to dial numbers programmatically:
(void) dialPhone:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options {
NSString* url;
NSString* number = [options valueForKey:@"number"];
//NSLog(@"number: %@", number);
if([number hasPrefix:@"tel://"]) {
url = number;
}
else {
// escape characters such as spaces that may not be accepted by openURL
url = [NSString stringWithFormat:@"tel://%@", number];
}
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:url]];
}
And it works perfectly with one exception: I can't dial numbers like '10' (full url is tel://10). The application simply does nothing. No alerts, no errors. However, if I add some more symbols before the actual number I need, like '000', it works. Really looking for some guidance.