【问题标题】:AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS RN48必须将 AirGoogleMaps 目录添加到您的 xCode 项目以支持 iOS RN48 上的 GoogleMaps
【发布时间】:2017-11-08 20:07:37
【问题描述】:

我在我的项目中安装了 react-native-maps 在 Android 中运行良好,但我总是出现错误,编译良好但在 ios 中执行时出错:

console.error: "react-native-maps: AirGoogleMaps 目录必须添加到您的 xCode 项目以支持 iOS 上的 GoogleMaps"。

"dependencies": {

"react": "16.0.0-alpha.6",

"react-native": "0.48.4",

"react-native-maps": "^ 0.17.1",

... }

【问题讨论】:

    标签: javascript reactjs react-native compiler-errors


    【解决方案1】:

    我一周前遇到了这个问题,昨天我解决了。
    首先,我的文件结构如下,我的版本和你完全一样。

    MyApp--- ios
           |
           - android
           |
           - js- node-modules
               |
               - index.js
               |
               - etc...
    


    可能和你没什么不同,只是文件结构而已。

    • 我使用 pod 安装 react-native-maps,但我从不链接 react-native。 安装 react-native-maps 后,现在可以使用 iOS 原生地图了。 确保您已经可以使用 iOS 地图,之后我将带您完成。

    • 在您的 xcode 项目左侧边栏中单击右键并单击 Add files to "your project" 并选择 node_modules/react-native-maps/lib/ios/AirGoogleMap

    • 转到您的项目 => 目标 => 构建设置 => 标头搜索路径 并双击添加路径$(SRCROOT)/../js/node_modules/react-native-maps/lib/ios(这是我的文件结构)并将非递归变为递归。
      如果你的文件结构是像 react-native 这样官方的,你应该添加这样的路径$(SRCROOT)/../node_modules/react-native-maps/lib/ios

    写完了,希望对你有帮助。

    【讨论】:

    • 感谢您的回复,对我帮助很大。问候
    【解决方案2】:

    评论 PROVIDER_GOOGLE 并自动反应原生地图将使用 iOS 地图。

    <MapView 
        style={styles.map}
       //provider={PROVIDER_GOOGLE}
     />
    

    【讨论】:

    • 这个答案让我很开心。谢谢朋友
    • 哇!!它真的拿起了 iOS 地图。!!
    猜你喜欢
    • 1970-01-01
    • 2019-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-11
    • 2011-11-16
    • 1970-01-01
    相关资源
    最近更新 更多