如何使用“##”拨打电话号码? [英] How to dial a phone number with "##"?

查看:178
本文介绍了如何使用“##”拨打电话号码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iPhone上拨打## 8004664411这样的电话号码。

I want to dial a phone number like "##8004664411" in IPhone.

如果我拨打号码8004664411,它可以正常工作。但是如果这个号码包含符号##,它不起作用。

If I dial the number "8004664411",it works.But if the number contains the symbol"##",it doesn't work.

这是我正在使用的代码不起作用:

Here is the code that I am using which is not working:

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

转义字符是否错误?

推荐答案

我担心您根本无法拨打包含*或#字符的号码。出于安全原因,Apple似乎不允许使用拨号字符串。以下是文档的相关部分。

I am afraid that you simply cannot dial a number containing * or # characters. It seems that Apple doesn't allow them in a dial string for security reasons. Below is the relevant part of the documentation.

来自Apple的文档


防止用户恶意重定向电话或更改
电话或帐户的行为,电话应用程序支持
电话方案中的大多数但不是全部的特殊字符。
具体来说,如果URL包含*或#字符,则Phone
应用程序不会尝试拨打相应的电话号码。
如果您的应用程序收到来自用户的URL字符串或未知的
来源,您还应该确保URL中可能不合适的
的任何特殊字符都可以正确转义。对于本地
应用程序,使用stringByAddingPercentEscapesUsingEncoding:
NSString方法来转义字符,它返回原始字符串的正确
转义版本。

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.

注意: stringByAddingPercentEscapesUsingEncoding:部分不适用于*和#(我试过了是的......)

Note: The stringByAddingPercentEscapesUsingEncoding: part does not apply to * and # (I've tried it yes...)

这篇关于如何使用“##”拨打电话号码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆