从应用程序拨打带格式号码的电话号码

问题描述:

我正在寻找来自我的应用程序拨打电话的一点帮助。电话号码格式为(###)### - ####。从应用程序拨打带格式号码的电话号码

在我.h我有这样的:

IBOutlet UITextView *PhoneNumber; 

在我.m我尝试这些:

- (IBAction)callPhone:(id)sender 

    [[UIApplication sharedApplication] openURL: 
    [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",PhoneNumber.text]]]; 

我不能让它拨出号码。但是,当我尝试这个工作。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:#########"]]; 

我认为这是你在找什么:Remove all but numbers from NSString

this网站,破折号应该没问题。只要删除括号。

+0

我觉得空间也是一个问题。 – Rob 2012-06-27 00:40:54