我的应用程序使用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和sms的访问源
<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上工作时,因此它可能是一个错误。
评论下面的allow-navigation
和access origin launch-external
链接来自config.xml(Manifest)的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-navigation
和access origin launch-external
链接:
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />