首页 > 解决方案 > RCTConvert+AirMap.h 文件在 IOS 上的 React Native 上找不到错误

问题描述

在此处输入图像描述

我有这个错误。RCTConvert+AirMap.h 文件在 IOS 上的 React Native 上找不到错误

标签: iosxcodereact-native

解决方案


最近更新

对于类似或最新的配置


    "react": "17.0.1",
    "react-native": "0.64.2",
    "react-native-cli": "^2.0.1",
    "react-native-maps": "^0.28.0",

使用 GoogleMap 和其他地图提供者配置 React Native Maps 非常容易。

自动链接并不能解决问题,因此您必须手动判断xcode本机代码的位置。有2种方式告诉

  1. 在此处使用这些说明手动将文件/文件夹添加到 Xcode
  2. 最简单的。无需转到Xcode进行调整header search path

2.最简单的

# Podfile

pod 'react-native-google-maps', :path => '../../../node_modules/react-native-maps/'
pod 'react-native-maps', :path => '../../../node_modules/react-native-maps/'

# These might not be necessary
# Please build without these. If could not build, add these as well
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'

AppDelegate.m文件中

#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h> // this line is alreaady there.  Add the line below
#import <GoogleMaps/GoogleMaps.h>

...

...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions // this line is alreaady there.  Add the line below
{
+  [GMSServices provideAPIKey:@"AIzaEEBBLn-PhCDDD1AnC_h66yH8LEEUkd14WW0"]; // add this line using the api key obtained from Google Console

笔记:

  1. 从谷歌控制台替换AIzaEEBBLn-PhCDDD1AnC_h66yH8LEEUkd14WW0为您自己的 API 密钥。
  2. 就我而言,我正在使用 monorepo 技术'../../../node_modules/react-native-maps/'。在你的情况下'../node_modules/react-native-maps/'
  3. +并且-应该使用标志。它们是语言定义的实体。没有类型错误

推荐阅读