1

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 the device of course.

What am I missing ?

EldenChris
  • 1,059
  • 1
  • 10
  • 16

3 Answers3

2

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 !

EldenChris
  • 1,059
  • 1
  • 10
  • 16
1

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

Ed Marty
  • 39,590
  • 19
  • 103
  • 156
  • Mmm It doesn't work neither. I get this in the console now : < warning > Ignoring unsafe request to open URL tel:18 – EldenChris Apr 12 '10 at 20:46
  • Well, that seems like it's just not letting you call that number because it knows it's an emergency number or something. Try using a regular phone number and see if that works. If it does, then the SDK is just set up not to let you dial 18 programmatically. – Ed Marty Apr 12 '10 at 21:30
  • It seems like it doesn't work for any combination of 2 numbers but I saw another application that could make it. I just wonder how... – EldenChris Apr 12 '10 at 21:40
  • I'm not familiar with non-US phone numbers, so I don't know what all of the + and # and (Wait) things mean, but have you tried putting something like a + or a - in the number that doesn't actually change the number dialed, but increases its length – Ed Marty Apr 12 '10 at 21:51
  • Ok so I tried +, # and the only way it worked was by inserting a pause after 18 like this : "tel:18p" BUT it shows in the phone application : "18," and i would like to avoid it and have only "18"... – EldenChris Apr 12 '10 at 22:27
1

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&sharp;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.

Antoine
  • 146
  • 1
  • 4