【发布时间】:2019-11-14 21:28:48
【问题描述】:
我正在使用 ionic-3 开发 Hybrid 应用程序。我正在实施google map 并试图在我的应用程序中获取当前位置。地图在 android 和浏览器中运行良好,但是当我在 ios 中构建它时,出现权限错误。我在config.xml 中添加了配置文件以获取权限
Config.xml 中的配置文件
<config-file file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>To get your location and provide better service</string>
</config-file>
<config-file file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
<string>To get your location and provide better service</string>
</config-file>
<config-file parent="NSCameraUsageDescription" target="*-Info.plist">
<string>need camera to take your profile picture</string>
</config-file>
我收到如下图所示的错误
你能建议我任何解决方案吗? 谢谢。
【问题讨论】:
-
您是否将选项传递给 Geolocation.getCurrentPosition()?
-
是的,我的代码是这样的 "Geolocation.getCurrentPosition().then((position) => {}"
-
试试这个。让选项= {超时:10000,enableHighAccuracy:真}; Geolocation.getCurrentPosition(options).then((resp) => { console.log("position", resp) }).catch((error) => { console.log('error: ', error); }) ;确保使用最新的插件,并且您的 iPhone 设备中的 GPS 位置处于“开启”状态
-
感谢您的回复,但没有帮助。我现在正在关注错误。 "操作无法完成(KCLErrorDomain error 0)"
标签: ios google-maps permissions geolocation ionic3