首页 > 解决方案 > ios中的ionic 3 geolocation位置错误

问题描述

我正在Hybrid使用 ionic-3 开发应用程序。我正在实施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>

我收到如下图所示的错误

在此处输入图像描述

在此处输入图像描述

你能建议我任何解决方案吗?谢谢你。

标签: iosgoogle-mapspermissionsgeolocationionic3

解决方案


最后我得到了解决方案。我只需要设置我的模拟器当前位置。我会解释它,也许它会帮助别人。

  1. 在 iPhone 模拟器中运行项目
  2. 在Debug菜单下,最后一项是“Location”;这给了你一个子菜单
  3. 选择“自定义位置”
  4. 设置您的位置。而已

在此处输入图像描述


推荐阅读