如何使用“##”拨打电话号码?

编程入门 行业动态 更新时间:2024-10-05 07:25:18
本文介绍了如何使用“##”拨打电话号码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在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...)

更多推荐

如何使用“##”拨打电话号码?

本文发布于:2023-11-28 03:19:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640758.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   电话号码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!