React Native/Xcode 升级,现在找不到 RCTConvert.h [英] React Native / Xcode Upgrade and now RCTConvert.h not found

查看:47
本文介绍了React Native/Xcode 升级,现在找不到 RCTConvert.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用在 React Native 0.35.0 上运行良好.通过 react-native-git-upgrade 更新到 0.40.0 后,我在尝试在 XCode 中构建/运行应用程序时遇到了许多词法/预处理器问题.

App ran fine on React Native 0.35.0. After updating to 0.40.0 via react-native-git-upgrade I get a number of lexical/preprocessor issues when trying to build/run the app in XCode.

React/RCTBridgeModule.h' 文件未找到

点击问题时,我看到突出显示:

When clicking on the issue I see this highlighted:

#import

这似乎不是搜索路径问题.

It doesn't appear to be a search path issue.

我尝试删除 node_modules 并再次运行 npm install,但这并没有解决任何问题.

I've tried deleting node_modules and running npm install again, but that hasn't fixed anything.

推荐答案

正如 th0th 所指出的,iOS 的 RN 0.40 有一个突破性的变化.简而言之,RN 头声明被更新为指向包含路径 $(BUILT_PRODUCTS_DIR)/include/React.

As pointed out by th0th, there is a breaking change in RN 0.40 for iOS. In short, RN header declarations are updated to point to the include path $(BUILT_PRODUCTS_DIR)/include/React.

要解决此问题,您必须执行以下操作:

To solve the issue, you have to do the following:

  1. 在 Xcode 中,转到项目方案(产品 -> 方案 -> 管理方案 -> 双击您的项目).
  2. 点击左侧窗格中的构建"选项.
  3. 取消选中构建选项下的并行构建".
  4. 然后在目标部分,点击+"按钮,然后搜索React".选择它并点击添加".
  5. React"现在应该出现在目标部分下.单击并将其拖到顶部,使其成为列表中的第一项(在您的项目之前).
  6. 清理项目并构建.
  1. In Xcode, go to the project scheme (Product -> Scheme -> Manage Scheme -> double click your project).
  2. Click on the 'Build' option at the left pane.
  3. Uncheck 'Parallelize Build' under Build Options.
  4. Then in Targets section, click '+' button then search for 'React'. Select it and click 'Add'.
  5. 'React' should now appear under Targets section. Click and drag it to the top so that it will be the first item in the list (before your project).
  6. Clean the project and build.

注意:您可能仍然存在与其他库(例如 react-native-fbsdk)类似的头文件问题,这些库指的是那些 react native .h 文件.

Note: You might still have similar header issue with other libraries (e.g. react-native-fbsdk) that are referring to those react native .h files.

这篇关于React Native/Xcode 升级,现在找不到 RCTConvert.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆