Warm tip: This article is reproduced from serverfault.com, please click

其他-如何在Cordova上删除iOS Geolocation身份验证请求消息

(其他 - How to remove ios geolocation auth request message on cordova)

发布于 2020-11-26 00:58:44

我正在使用Cordova制作应用程序。

科尔多瓦中的某些页面(index.html)要求获得位置许可,这是针对某个功能的。

在Xcode中修改plist以获得位置权限后,我不断收到以下消息

这是我的设置和出现的消息

在此处输入图片说明

在此处输入图片说明

我寻求解决此消息的原因(/ private / var / containers / Bundle / Application ... /www/index.html Geolocation auth),但没有正确的答案。我应该怎么办?

Questioner
Cwpark
Viewed
11
Eric 2020-12-01 04:51:37

你需要安装cordova-plugin-geolocation(cordova插件添加cordova-plugin-geolocation),然后在config.xml中为iOS设置首选项,例如

    <edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
        <string>need to access your location for reasons</string>
    </edit-config>
    <edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysAndWhenInUseUsageDescription">
        <string>need to access your location for reasons</string>
    </edit-config>
    <edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
        <string>need to access your location for reasons</string>
    </edit-config>

当然可以编辑

由于某些原因需要访问你的位置