链接从iOS上的Phonegap打开位智应用

Con*_*lel 2 ios cordova waze

当用户单击Phonegap应用程序中的以下链接时,我试图打开“ Waze”应用程序。

它在android上运行良好,但在IOS上却根本无法运行。

<a href="waze://?ll=latitude,longitude">Waze</a>
Run Code Online (Sandbox Code Playgroud)

我需要为iOS做不同的事情吗?

Dav*_*den 5

Waze开发人员文档所述,这是适用于iOS的正确URL方案。

但是,正如该页面上所示,在iOS9 +上,您需要在应用程序.plist中将该方案列入白名单:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>waze</string>
</array>
Run Code Online (Sandbox Code Playgroud)

为此,您可以在Cordova应用中手动编辑plist,也可以platforms/ios/MyProject/MyProject-Info.plist使用cordova-custom-config插件通过以下代码块将其添加config.xml

<platform name="ios">
    <config-file platform="ios" target="*-Info.plist" parent="LSApplicationQueriesSchemes">
        <array>
            <string>waze</string>
        </array>
    </config-file>
</platform>
Run Code Online (Sandbox Code Playgroud)