加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

React Native iOS:无法构建模块’yoga’:’algorithm’文件未

发布时间:2020-12-15 20:46:13 所属栏目:百科 来源:网络整理
导读:我正在尝试使用此集成指南将React Native集成到现有的 Swift iOS应用程序中: https://facebook.github.io/react-native/docs/integration-with-existing-apps.html.React Native的版本为0.53.0. 我已经成功安装了所有必需的pod,现在尝试构建项目,但总是得到
我正在尝试使用此集成指南将React Native集成到现有的 Swift iOS应用程序中: https://facebook.github.io/react-native/docs/integration-with-existing-apps.html.React Native的版本为0.53.0.

我已经成功安装了所有必需的pod,现在尝试构建项目,但总是得到以下编译错误:


错误日志:

While building module 'yoga' imported from ...node_modules/react-native/React/Base/RCTConvert.h:19:
In file included from <module-includes>:1:
In file included from ...ios/Vandebron/Pods/Target Support Files/yoga/yoga-umbrella.h:15:
In file included from ...node_modules/react-native/ReactCommon/yoga/yoga/YGNode.h:13:
...node_modules/react-native/ReactCommon/yoga/yoga/Yoga-internal.h:11:10: fatal error: 'algorithm' file not found
#include <algorithm>
         ^~~~~~~~~~~
1 error generated.
In file included from ...node_modules/react-native/React/Views/RCTActivityIndicatorViewManager.m:10:
In file included from ...node_modules/react-native/React/Views/RCTActivityIndicatorViewManager.h:10:
In file included from ...node_modules/react-native/React/Views/RCTViewManager.h:13:
...node_modules/react-native/React/Base/RCTConvert.h:19:9: fatal error: could not build module 'yoga'
#import <yoga/Yoga.h
这是一个cocoapods问题.尝试通过编辑yoga.podspec文件来公开所需的标题:node_modules / react-native / ReactCommon / yoga / yoga.podspec
在yoga.podspec结束时添加这一行:

spec.public_header_files =’yoga / Yoga.h’,’yoga / YGEnums.h’,

看起来像这样:

source_files = 'yoga/**/*.{cpp,h}'
       source_files = File.join('ReactCommon/yoga',source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']       
       spec.source_files = source_files    spec.source_files = source_files
+
+  # Only expose the needed headers
+  spec.public_header_files = 'yoga/Yoga.h','yoga/YGEnums.h','yoga/YGMacros.h'
+
end

参考:https://github.com/facebook/react-native/issues/17893

实际拉动请求:https://github.com/facebook/react-native/pull/17764.看看Plo4ox的评论.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读