ios - 使用 swift 从 iOS 应用程序调用特殊号码

标签 ios iphone swift ios8

<分区>

我希望能够使用 swift 调用特殊号码来检查当前余额或了解某些服务的状态。我尝试了以下代码,但没有成功

    let url:NSURL = NSURL(string:"tel://*120#")!;
    UIApplication.sharedApplication().openURL(url);

有什么想法吗?

最佳答案

To prevent users from maliciously redirecting phone calls or changing the behavior of a phone or account, the Phone app supports most, but not all, of the special characters in the tel scheme. Specifically, if a URL contains the * or # characters, the Phone app does not attempt to dial the corresponding phone number.

https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html

关于ios - 使用 swift 从 iOS 应用程序调用特殊号码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30032407/

相关文章:

iOS 宽高比约束在 iOS7 上失效,适用于 iOS8

objective-c - 我们可以为类对象使用 setvalue 和 forkey 属性吗?

iphone - 使用按钮而不是表格的基于导航的应用程序?

iphone - 为动态创建的 UIView 设置动画

swift - 如何在数组循环中对所有子类进行静态函数调用?

ios - 可针对任何尺寸类别进行调整的文本尺寸

objective-c - 在这种情况下,为什么我会收到发送到已释放实例的消息错误?

iphone - 应用程序似乎在锁定屏幕后一段时间后退出,这是正常行为吗?

ios - 将 UIPageViewController 添加到框架小于整个 View Controller 的现有 View Controller 中

IOS/Objective-C : Conflicting return type in implementation error