23

I am trying to open a url ( "tel:061245124" or "mailto:test@test.com") and it says that i can handle url, also tried without the tel: or mail to but it crashes with a red screen. Urls like "http://test.com" work. What am I doing wrong?

    handlePress(url) {
    console.tron.log('Trying to access url')
    console.tron.log(url)
    Linking.canOpenURL(url).then(supported => {
      if (!supported) {
        console.tron.log('Can\'t handle url: ' + url)
      } else {
        return Linking.openURL(url)

      }
    }).catch(err => console.error('An error occurred', err))
  }
AleXzpm
  • 1,024
  • 2
  • 10
  • 22

1 Answers1

57

The code works perfectly the problem was the iOS simulator, it needs to be tested on a device.

AleXzpm
  • 1,024
  • 2
  • 10
  • 22
  • 2
    Is this 'no-soluion' valid even for the 'tel:xxx' links? I'm not able to start dialer on ios simulator – realtebo Mar 08 '18 at 09:07
  • 1
    yeah, you can not start the dialer on a simulator from what I have seen. Try using it on a device. – AleXzpm Mar 08 '18 at 13:11