以编程方式从iPhone拨打USSD代码 [英] dial USSD code from iphone programmatically

查看:267
本文介绍了以编程方式从iPhone拨打USSD代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式拨打iphone的USSD代码?

How to dial USSD code for iphone programmatically?

我经过搜索后发现,出于安全原因,iOS 7已经阻止了USSD代码的使用,并且在具有<在iOS7上,我们可以手动拨打USSD代码,但不能通过编程方式拨打.

I searched and found that iOS 7 has already blocked use of USSD code for security reason and in iPhones with < iOS7 we can dial a USSD code manualy but not programmatically.

任何人都有一个主意,我们可以通过编程方式调用USSD吗?

Any one have an idea, can we call USSD programmatically like:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:\*123* <2334555>#"]]?

推荐答案

您不能拨打包含*或#个字符的号码.出于安全原因,Apple不允许在拨号字符串中使用它们.

You cannot dial a number containing * or # characters. Apple doesn't allow them in a dial string for security reasons.

Apple文档说:

为防止用户恶意重定向电话或更改电话 电话或帐户的行为,电话"应用支持的功能最多,但 并非所有电话方案中的特殊字符.具体来说,如果 URL包含*或#字符,电话"应用不会尝试 拨打相应的电话号码.如果您的应用收到网址 来自用户或未知来源的字符串,还应确保 URL中可能不合适的任何特殊字符是 正确地逃脱了.对于本机应用程序,请使用 stringByAddingPercentEscapesUsingEncoding:NSString的方法 转义字符,它会返回您的正确转义的版本 原始字符串.

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. If your app 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 apps, use the stringByAddingPercentEscapesUsingEncoding: method of NSString to escape characters, which returns a properly escaped version of your original string.

这篇关于以编程方式从iPhone拨打USSD代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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