2013-08-02 103 views
0

我正在开发一个应用程序的PhoneGap,其中包括使用原生拨号符号。我使用此代码以编程方式拨打的号码:拨打电话号码,小于在PhoneGap的iPhone应用程序

(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]]; 
} 

而且它有一个例外完美的作品:我无法拨通号码,如“10”(完整的URL为tel:// 10)。应用程序根本无所作为。没有警报,没有错误。但是,如果我的实际数量,我需要,像“000”之前多增加一些符号,它的工作原理。 真的找一些指导。

回答

0

如果有人遇到同样的问题,这是我的解决方法:我已经把电话“1'after数量,因此完整的URL成了?:?10 1“,并且做的伎俩。