修复Cordova地理位置请求位置消息 [英] Fix Cordova Geolocation Ask for Location Message

查看:1233
本文介绍了修复Cordova地理位置请求位置消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人使用cordova,html的经验,知道如何解决iOS的地理位置讯息问题?我只想让邮件说出应用名称,后面紧跟一行想要使用您当前的位置。

Does anyone have experience using cordova, html and know how to fix this geolocation message issue for iOS? I just want the message to say the app name followed by the line, "would like to use your current location."

当前地理位置消息:


/// Users / kklsndksjladn / Library / Developer / CoreSimulator / Devices / FAF7EE4C-40BA-430A-80D5-5C84B07D970D / data / Containers / Bundle / Application / DAE305B6 -C6DD-438B-B4D7-9B183A8B2D97 / HelpME.app / www / index.html

///Users/kklsndksjladn/Library/Developer/CoreSimulator/Devices/FAF7EE4C-40BA-430A-80D5-5C84B07D970D/data/Containers/Bundle/Application/DAE305B6-C6DD-438B-B4D7-9B183A8B2D97/HelpME.app/www/index.html

我尝试过各种解决方案和其他网站。我实现了 navigator.geolocation.getCurrentPosition(onSuccess,onError); 代码,包括我的cordova.js文件在每个html页面,确保<脚本> src = cordova.js< / script> 首先出现在我的index.html页面中,包括我的config.xml文件中的geolocation标记,并尝试使用我的plist。有人请帮助!!!!

I've tried various solutions from stack overflow and other websites. I implemented the navigator.geolocation.getCurrentPosition(onSuccess, onError); code, included my cordova.js file in every html page, made sure <script> src=cordova.js</script> appears first in my index.html page, included the geolocation tag in my config.xml file and tried playing around with my plist. Someone please help!!!!

- 谢谢

推荐答案

href =http://stackoverflow.com/users/777265/davealden> DaveAlden ,我不得不删除旧版本的geolocation插件并添加新的。然后我不得不删除/添加Cordova iOS平台。只有这样,我才能成功将 NSLocationWhenInUseUsageDescription 添加到.plist文件。

In addition to the answer from DaveAlden, I had to remove the old version of the geolocation plugin and add the new one. Then I had to remove/add the Cordova iOS platform. Only then could I add NSLocationWhenInUseUsageDescription to the .plist file with success.

首先,删除/添加geolocation插件:

First, remove/add the geolocation plugin:

cordova plugin rm org.apache.cordova.geolocation
cordova plugin add org.apache.cordova.geolocation

其次,删除/添加iOS平台:

Second, remove/add the iOS platform:

cordova platform rm ios
cordova platform add ios

最后,将 NSLocationWhenInUseUsageDescription 添加到.plist。打开 / platforms / ios / {project} / {project} -Info.plist 并添加以下内容:

Last, add NSLocationWhenInUseUsageDescription to the .plist. Open /platforms/ios/{project}/{project}-Info.plist and add the following:

<key>NSLocationWhenInUseUsageDescription</key>
<string>[App Name] would like to access your location when running and displayed.</string>

查看此 iOS开发人员库链接,了解 NSLocationWhenInUseUsageDescription NSLocationAlwaysUsageDescription NSLocationUsageDescription

iPhone上的位置权限警报,Cordova 是可能的重复。

这篇关于修复Cordova地理位置请求位置消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆