开发者

Problem with a call button - doesn't open tel:// URL

I am trying to make a call button that will call 18 which is Fire Dept in France.

So my code is :

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

It doesn't work and I get this message in the console :

< warning > Ignoring unsafe request to open URL tel://18

But I saw other application that have the same button fully working !

I am trying this on th开发者_如何学JAVAe device of course.

What am I missing ?


Ok I Found the answer after wasting many hours...

Here is the solution :

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://18?1"]];

The iPhone accepts the interrogation mark but ignores it when initiating the call !

In Safari, if you try this :

tel://18

It won't work but if you try this :

tel://18?1

It will call 18 !


The correct url has no backslashes. That is, it should be tel:18


tel://18?1 works fine on iOS4, but it seems that iOS5 ignores everything after the ? character and refuses to just call 18...

However, tel://18♯1 works on iOS5 (and calls number 18) but not on iOS4, so you have to switch according to the iOS version of the client.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜