如何打开带有给定电话号码的电话应答来拨打电话?

don*_*ile 2 iphone

我有一个联系人管理应用程序,我将电话号码存储在核心数据中.这些只是简单地表示为文本,如+33(0)7324 65335-22.是否可以通过启动手机应用程序来拨打此号码?如果是,我必须对我的号码进行特殊格式化吗?

Mic*_*ler 6

NSString *phoneNumber = @"+33(0)7324 65335-22";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phoneNumber]]];
Run Code Online (Sandbox Code Playgroud)

我不确定"(0)"......

  • 这只是UIApplication打开一个URL.有关不同功能的可用前缀的完整列表,请查看:http://iphonedevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html (2认同)