ios - 无法使用 Objective-C 调用号码

标签 ios objective-c ios6

我使用的是iOS6,我无法调用这个号码:*222*20#

这是我的代码:

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:*222*20#"]]];

当我运行上面的脚本时没有任何反应?
又或许,拨号号码有一些限制?!

最佳答案

这是因为您的号码包含*#

To prevent users from maliciously redirecting phone calls or changing the behavior of a phone or account, the Phone application supports most, but not all, of the special characters in the tel scheme. Specifically, if a URL contains the * or # characters, the Phone application does not attempt to dial the corresponding phone number. If your application receives URL strings from the user or an unknown source, you should also make sure that any special characters that might not be appropriate in a URL are escaped properly. For native applications, use the stringByAddingPercentEscapesUsingEncoding: method of NSString to escape characters, which returns a properly escaped version of your original string.

请查看iPhoneURLScheme了解更多详情。

关于ios - 无法使用 Objective-C 调用号码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14377311/

相关文章:

objective-c - 如何在自定义 NSView 中设置光标?

ios - 游戏中心登录中的错误禁用功能

ios - 带有左右标签的 UITableViewCell。如何让它们正确显示?

ios - 无法检索 firebase 用户的消息

ios - 如何使用AFNetworking 2.0将所有网络请求限制为Wi-Fi连接?

ios - MapKit Xcode 编程

ios - 如何按 NSArray 内对象内的对象对 NSArray 进行排序?

objective-c - iOS : I can't write my file

ios6 - QLPreviewController在ios6中隐藏打印按钮

ios - 使用 FMDB 将数据插入 SQLite 时,dispatch_async 上的 EXC_BAD_ACCESS