电话:*和短信:*链接不适用于phonegap中的cordova下的ios?

时间:2017-01-19 19:54:34

标签: cordova phonegap-build

我的应用程序使用href:tel链接,它在一年前首次发布时正常工作。

我在config.xml中使用了allow-intent:

  <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:*"/>

但现在使用相同配置的iOS新编译的应用程序无法使用href:tel链接。没有任何事情发生。

如上所述:cordova - Why tel:* links don't work on ios? - Stack Overflow 我需要从config.xml中删除allow-navigation。但我没有那里。

使其在新的cordova下工作的正确配置是什么?

编辑:其他外部链接和短信:*也不行,但在iPad上tel:*链接提供复制号码(预期行为)

2 个答案:

答案 0 :(得分:1)

尝试删除tel和短信的访问来源

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

此外,您可以尝试将CLI版本设置为6.4.0,意图和导航过滤器在cordova-ios 4.3.0中的工作方式有一些变化,并且您使用的是4.2.0

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

但是我看到有关电话链接工作的错误报告,当应用程序在本地编译Cordova但没有在Phonegap Build上工作时,因此它可能是一个错误。

答案 1 :(得分:0)

在config.xml(清单)中注释以下allow-navigationaccess origin launch-external组链接,以使tel:,sms:和mailto:*链接起作用离子式Cordova或带Android和iOS的phonegap:

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

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

之所以如此,是因为最新的Cordova和Phonegap版本被设计为使用以下allow-intent链接集而不是allow-navigationaccess origin launch-external链接:

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