xcode 未找到构建失败的“React/RCTBridgeModule.h”文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53541573/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:52:37  来源:igfitidea点击:

Build failed 'React/RCTBridgeModule.h' file not found

iosxcodereact-nativecocoapods

提问by Hurobaki

I spent my day trying to fix my problem, I tried every solution I found in other SO posts but unfortunately I can't figure out how to solve my problem.

我花了一整天的时间试图解决我的问题,我尝试了在其他 SO 帖子中找到的所有解决方案,但不幸的是我不知道如何解决我的问题。

I try to integrate TouchID inside my react-native project. I downloaded a npm package called "react-native-touch-id" (sounds perfects !). I followed installation guide and I manually linked library to my project.

我尝试将 TouchID 集成到我的 react-native 项目中。我下载了一个名为“react-native-touch-id”的 npm 包(听起来很完美!)。我遵循安装指南,并手动将库链接到我的项目。

But when I try to run application I get the following error :

但是当我尝试运行应用程序时,出现以下错误:

main problem imageenter image description here

主要问题图片在此处输入图片说明

I tried to clean my project :

我试图清理我的项目:

  • rm -rf node_modules
  • yarn cache clean && yarn install
  • rm -rf ios/Pods/ && pod install
  • rm -rf node_modules
  • 纱线缓存清洁&&纱线安装
  • rm -rf ios/Pods/ && pod install

In xCode I even clean the build folder.

在 xCode 中,我什至清理了构建文件夹。

About my versions :

关于我的版本:

  • RN : 0.57.4
  • xCode : 10.1
  • react-native-touch-id : 4.3.0
  • 注册护士:0.57.4
  • 代码:10.1
  • react-native-touch-id : 4.3.0

Here's my Podfile :

这是我的 Podfile :

def available_pods
  pod 'TouchID', :path => "../node_modules/react-native-touch-id"
end
target 'App' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  available_pods
end

I added the .xcodeproj of react-native-touch-id package inside my project's libraries directory and in Build Phases I linked it.

我在我的项目的库目录中添加了 react-native-touch-id 包的 .xcodeproj ,并在构建阶段我链接了它。

enter image description hereenter image description here

在此处输入图片说明在此处输入图片说明

But I still getting the same error again and again ... I don't understand why ... If someone have an idea some help would be really appreciated :)

但我仍然一次又一次地遇到同样的错误......我不明白为什么......如果有人有想法,我会非常感谢你的帮助:)

采纳答案by Hurobaki

It appeared the problem was the Podfile. It seems that Podfile use its own Podspec which caused troubles. So I simply delete the TouchId pod declaration from my Podfile, clean and re-install my pods.

看来问题出在 Podfile 上。似乎 Podfile 使用了自己的 Podspec,这引起了麻烦。所以我只需从我的 Podfile 中删除 TouchId pod 声明,清理并重新安装我的 pod。

Then, I manually linked the library to my xcode workspace. To do that, under your project name, Right Click on Libraries directory => Add files to "your project name" => Add the xcodeproj of the npm's package located inside your node_modules directory.

然后,我手动将库链接到我的 xcode 工作区。为此,在您的项目名称下,右键单击库目录 => 将文件添加到“您的项目名称”=> 添加位于 node_modules 目录中的 npm 包的 xcodeproj

After that, in your project Build Phasesunder the Link Binary with Librariesyou have to add the npm's package static library (example libTouchID.a in my case).

之后,在Link Binary with Libraries下的项目Build Phases 中,您必须添加 npm 的包静态库(在我的例子中为 libTouchID.a)。

To be sure you can clean your project and try to rebuild, it should work now.

为确保您可以清理项目并尝试重建,它现在应该可以工作了。

For information, I kept all of my softwares version I mentionned above.

有关信息,我保留了上面提到的所有软件版本。

回答by Abey Thomas

If it shows react native(missing) in

如果它显示 react native(missing) in

product->scheme->manage scheme->project name->build

产品->方案->管理方案->项目名称->构建

  1. remove the ios folder
  2. react-native eject
  3. cd ios/
  4. pod init
  5. pod install
  6. cd ..
  7. react-native link
  8. cd ios
  9. open *.xcworkspace/
  1. 删除ios文件夹
  2. 反应本机弹出
  3. 光盘 ios/
  4. 豆荚初始化
  5. 吊舱安装
  6. 光盘..
  7. 反应原生链接
  8. 光盘
  9. 打开 *.xcworkspace/

this happens when the react native package is not linked properly to the ios build. The npm link does it.

当 react native 包没有正确链接到 ios 构建时,就会发生这种情况。npm 链接做到了。