我使用插件 cordova-plugin-geolocation.我唯一的问题是允许位置的消息提示如下所示: /var/container/bundle/application/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/my_project/www/index.html Would like to use your location. 反正有没
/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