找不到 React Native Xcode 头文件!RCTBridge模块 [英] React Native Xcode header files not being found! RCTBridgeModule

查看:55
本文介绍了找不到 React Native Xcode 头文件!RCTBridge模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 Xcode 或命令行在 ios 上运行时遇到词法或预处理器"问题.Android 构建良好.

I'm getting 'Lexical or Preprocessor' issues when I try and run on ios either in Xcode or command line. Android builds fine.

第一个错误是未找到React/RCTBridgeModule.h"文件.我可以通过将 <React/RCTBridgeModule.h> 更改为 "RCTBridgeModule.h" 来摆脱这个问题,但我最终陷入了无穷无尽的相同问题中每个模块.

The first error is 'React/RCTBridgeModule.h' file not found. I can get rid of this by changing <React/RCTBridgeModule.h> to "RCTBridgeModule.h" but I just end up in an endless stream of the same issue with every module.

我不认为这是一个重复的问题.我已经尝试了类似问题和 github 问题中的所有解决方案,但仍然无法构建;

I don't believe this is a duplicate question. I've tried all solutions in similar questions and github issues but still can't get it to build;

  • 未选中的并行构建
  • 确保导入使用更新的格式,例如#import
  • 删除了node_modules.xcworkspacepodfile.lock 并使用npm 重新安装/更新>纱线
  • 尝试了 react-native 升级
  • React 和 Pods 项目在 Edit Scheme > Build 中的项目上方列出
  • 尝试了 Xcode 9 和10 与 Legacy &新的构建系统

请检查图片中的路径

反应原生信息:

Environment:
  OS: macOS High Sierra 10.13.6
  Node: 8.11.1
  Yarn: 1.12.3
  npm: 6.5.0
  Watchman: 4.9.0
  Xcode: Xcode 10.1 Build version 10B61
  Android Studio: 3.2 AI-181.5540.7.32.5056338

Packages: (wanted => installed)
  react: 16.0.0 => 16.0.0
  react-native: 0.50.4 => 0.50.4

推荐答案

我的解决方案有时有点危险!

my solution a bit dangerous sometimes!

在过去,这发生在我尝试为 iOS 归档 0.40+ react-native 应用程序时(我在这里找到了解决方案 https://github.com/facebook/react-native/issues/11721#issuecomment-270672904)

in old days this happened when I was trying to archive a 0.40+ react-native app for iOS (i found a solution here https://github.com/facebook/react-native/issues/11721#issuecomment-270672904)

我觉得 Xcode 在实际构建 react 库之前试图与隐式 react 依赖项并行构建 react-native 库.

i felt like Xcode was trying to build the react-native libraries in parallel with implicit react dependencies before actually building the react library.

所以这有点帮助!

  • 在 Xcode 中,转到项目方案(产品 -> 方案 -> 管理方案 -> 双击您的项目).

  • In Xcode, go to the project scheme (Product -> Scheme -> Manage Scheme -> double click your project).

点击左侧窗格中的构建"选项.

Click on the 'Build' option at the left pane.

在构建选项下取消选中并行构建".

Uncheck 'Parallelize Build' under Build Options.

然后在目标"部分,单击+"按钮,然后搜索React".选择它并单击添加".React"现在应该出现在目标"部分下.单击并将其拖到顶部,使其成为列表中的第一项(在您的项目之前).

Then in Targets section, click '+' button then search for 'React'. Select it and click 'Add'. '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).

清理项目并构建.

对于这种情况,我发现有一些更简单的解决方案被列入另一个 stackQuestion 这里

there are a few more trivial solutions for this scenario that i found are enlisted on another stackQuestion here

这篇关于找不到 React Native Xcode 头文件!RCTBridge模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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