【问题标题】:RCTConvert+AirMap.h file not found Error on React Native on IOSRCTConvert+AirMap.h 文件在 IOS 上的 React Native 上找不到错误
【发布时间】:2020-08-05 08:18:46
【问题描述】:

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

【问题讨论】:

  • 面临同样的错误。 @cute soft 你有解决方法吗?

标签: ios xcode react-native


【解决方案1】:

最新更新

对于类似或最新的配置


    "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 本地代码在哪里。 有两种方式告诉

  1. 手动将文件/文件夹添加到 Xcode using these instructions here
  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 替换为您在 Google 控制台中的 API 密钥。
  2. 就我而言,我使用的是 monorepo 技术,所以'../../../node_modules/react-native-maps/'。在您的情况下,它是'../node_modules/react-native-maps/'
  3. 应使用+- 符号。它们是语言定义的实体。没有类型错误

【讨论】:

    【解决方案2】:

    我能够解决这个问题:

    1. 在项目目标头中添加$(SRCROOT)/../node_modules/react-native-maps/lib/ios/AirMaps

    2. pod 'react-native-google-maps', path: rn_maps_path 移动到 Podfile 中的 use_native_modules 上方(之前在该模块下方)

    3. 添加:

      post_install do |installer|
          //...
          if target.name == 'react-native-google-maps'
            target.build_configurations.each do |config|
              config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
            end
          end
          
        end
      end
    
    1. 在第 3 步之后,如果仍然无法正常工作,请删除所有缓存 (pod deintegrate, pod install, remove derived data, clean build)

    【讨论】:

      猜你喜欢
      • 2023-02-13
      • 2021-04-18
      • 2017-06-19
      • 2019-08-10
      • 1970-01-01
      • 2021-12-17
      • 1970-01-01
      • 2022-07-11
      • 2019-06-26
      相关资源
      最近更新 更多