Forum Xamarin.Forms

Device.OpenUri problems

tomaszBDtomaszBD Member ✭✭
edited May 2018 in Xamarin.Forms

Hi all, I am trying to use Device.OpenUri() method to open up a dialer with a "static" contact number for callback. I am using .Net Standard 2 and most recent Xamarin Forms. It's all working fine when I am testing on my Android v8.0 (device, not emulator), but nothing happens in iOS / Simulator, running iPhone 6 iOS 9.2.

As it wasn't working for me, I tried searching for a solution, but nothing comes up. So I tried to use a plugin - Xam.Plugins.Messaging, installed in my PCL and platforms.

My attempt to make a call as per the example in the docs throws up with messages no matter what I do, and I run out of ideas. I dag through the lot on internet and can't find anything that would point me to where I am going wrong.

When I don't have the following in my Info.plist

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>tel</string>
</array>

the error throws up as

-canOpenURL: failed for URL: "tel:0000000000" - error: "this app is not allowed to query for scheme tel"

with that added, the error is:

-canOpenURL: failed for URL: "tel:0000000000" - error: "(null)"

I also tried the Device.OpenUri("tel:whateverthenumber") with the Info.plist, but that does nothing either, I get the following

LaunchServices: ERROR: There is no registered handler for URL scheme tel

Surely, a simple task like opening a dialer should take 2 lines of code, no...? Help...

Answers

  • SirAndriySirAndriy USMember ✭✭✭

    Did you tried run on iOS device? I mean real iPhone?

  • tomaszBDtomaszBD Member ✭✭

    How bizarre, just tested on the real device and it's doing what it needs to do...

    That's unacceptable for me to be honest, absolute nonsense. Build and test the app on simulator and hope for the best when you're about to release it?! (rant to self)

Sign In or Register to comment.