React-Native 新的 ios 项目未构建。 RCT-Folly 语义问题

我按照 https://reactnative.dev/docs/environment-setup 中的步骤操作,在初始化应用程序后,当我去构建我的应用程序时,它在终端中给了我这个错误:

** BUILD FAILED **

The following build commands failed:
    CompileC /Users/----/Library/Developer/Xcode/DerivedData/AwesomeProject-fneeqrmgpvoyyygpzbykmsofeknl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/x86_64/SysUio.o /Users/asaadat/Documents/CollegeStuff/EECS 441/test_app/AwesomeProject/ios/Pods/RCT-Folly/folly/portability/SysUio.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
    CompileC /Users/----/Library/Developer/Xcode/DerivedData/AwesomeProject-fneeqrmgpvoyyygpzbykmsofeknl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/x86_64/NetOps.o /Users/asaadat/Documents/CollegeStuff/EECS 441/test_app/AwesomeProject/ios/Pods/RCT-Folly/folly/net/NetOps.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
(2 failures)

在 xcode 中,当我尝试构建 ios 应用程序时,它向我显示: xcode screenshot

我已经尝试重新安装 pod 和 pod repo 更新,甚至重新开始教程。我还删除了 node_modules 并再次安装了 npm。还是一样的错误。我在 React-Native 0.66 上。

我是使用 react-native 和 ios 开发的新手,我很困惑为什么一个全新的项目会显示这一点。

这是我的 Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'AwesomeProject' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'AwesomeProjectTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
stack overflow React-Native new ios project not building. RCT-Folly Semantic issues
原文答案

答案:

作者头像

我已经做出了更完整的答案,因此我们可以合作提出更好的答案。不过既然被抹掉了,那我在“解决”的时候就比较直接了。

注释掉文件 line typedef uint8_t clockid_t; 中的 Pods/RCT-Folly/folly/portability/Time.h 。以 // 为前缀进行注释。

作者头像

这个线程对我帮助很大: https://github.com/facebook/flipper/issues/834#

我将最低版本从 10 更改为 12: __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_12_0 in Pods>RTC-Folly>Time where error发生以解决问题。

enter image description here