如何使用"*" IOS中的char? [英] How to call (dialing) with " * " char in IOS?

查看:246
本文介绍了如何使用"*" IOS中的char?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望用*字符致电.例如:* 711313.

I hope to call with * character. ex> *711313.

当前,我正在使用以下代码:

Currently, I'm using this code:

NSString *str = [NSString stringWithFormat:@"tel:%@", tmp];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];

我测试了两种情况:

  1. tmp = @"719929292"; //还行吧.打电话.

  1. tmp = @"719929292"; //this is ok. make call.

tmp = @"* 7128282"; //app没有反应.不打电话.

tmp = @"*7128282"; //app no reaction. not to call.

如何用*(星号)呼叫?

How can I call with *(star character)?

推荐答案

可能必须对星形进行编码才能在URL中使用.尝试使用%2A代替*.

The star may have to be encoded for use in a URL. Try %2A instead of *.

由于*是有效的URL字符,尽管具有特殊含义,但stringByAddingPercentEscapesUsingEncoding:不会执行此替换.

This replacement is not done by stringByAddingPercentEscapesUsingEncoding: since * is a valid URL character, albeit with a special meaning.

这篇关于如何使用"*" IOS中的char?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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