当前位置 : 主页 > 手机开发 > cordova >

Cordova iOS位置信息

来源:互联网 收集:自由互联 发布时间:2021-06-10
我使用插件 cordova-plugin-geolocation.我唯一的问题是允许位置的消息提示如下所示: /var/container/bundle/application/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/my_project/www/index.html Would like to use your location. 反正有没
我使用插件 cordova-plugin-geolocation.我唯一的问题是允许位置的消息提示如下所示:

/var/container/bundle/application/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/my_project/www/index.html
Would like to use your location.

反正有没有更性感的东西,比如说

my_project would like to use your location

干杯.

为非信徒添加了一些代码

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady(){

    navigator.geolocation.getCurrentPosition(onLocationSuccess, onLocationError, {maximumAge:3000, timeout:2000, enableHighAccuracy:true});

    function onLocationSuccess(){

    }

    function onLocationError(){

    }
 }
解决方案已经改变了cordova-plugin-geolocation:“4.0.0”.这是您需要在config.xml中添加的内容:

<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>need location access to find things nearby</string>
</edit-config>

有关更多信息:https://github.com/apache/cordova-plugin-geolocation

网友评论