Tel:* and Sms:* links don't work on ios under cordova in phonegap?

ε祈祈猫儿з 提交于 2019-12-13 00:22:48

问题


My app uses href: tel links and it worked correctly, when I first released it a year ago.

I used allow-intent in my config.xml:

  <access origin="*"/>
  <access origin="tel:*" launch-external="yes"/>
  <access origin="sms:*" launch-external="yes"/>
  <plugin name="cordova-plugin-whitelist"/>
  <allow-intent href="http://*/*"/>
  <allow-intent href="https://*/*"/>
  <allow-intent href="tel:*"/>
  <allow-intent href="sms:*"/>
  <allow-intent href="mailto:*"/>
  <allow-intent href="geo:*"/>

But now freshly compiled app for iOS with the same config doesnt work with href: tel links. Just nothing happens.

As said here: cordova - Why tel:* links don't work on ios? - Stack Overflow I need to remove allow-navigation from config.xml. But I dont have it there.

What is the proper configuration to make it work under new cordova?

EDIT: other external links and sms:* dont work as well, but on iPad tel:* link offers to copy number (expected behaivior)


回答1:


Try removing the access origin for tel and sms

<access origin="tel:*" launch-external="yes"/> <access origin="sms:*" launch-external="yes"/>

Also you can try setting the CLI version to 6.4.0, there has been some changes in how the intent and navigation filter worked in cordova-ios 4.3.0 and you are using 4.2.0

<preference name="phonegap-version" value="cli-6.4.0" />

But I've seen a bug report about tel links working when the app was locally compiled with Cordova but not working on Phonegap Build, so it might be a bug there.




回答2:


Comment both the below allow-navigation and access origin launch-external sets of links from config.xml (Manifest) for the tel:, sms: and mailto:* links to work on ionic cordova or phonegap with android and ios:

<allow-navigation href="tel:*" />
<allow-navigation href="mailto:*" />

<access origin="tel:*" launch-external="yes" />
<access origin="mailto:*" launch-external="yes" />

Maybe, this is so because the latest Cordova and Phonegap versions are designed to use the below set of allow-intent links instead of allow-navigation and access origin launch-external links:

<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" /> 


来源:https://stackoverflow.com/questions/41750541/tel-and-sms-links-dont-work-on-ios-under-cordova-in-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!