ios - Pods/RCT-Folly/folly/portability/Time.h 和不同类型的 Typedef 重新定义错误 ('uint8_t'(又名 'unsigned char')与 'enum clockid_t')

标签 ios react-native folly fbflipper

我正在查看 react native 项目的源代码,但在构建它时遇到了问题。
运行以下命令后

  • npm install在项目的根目录
  • pod install在ios文件夹

  • 我在终端收到以下消息:
    sh: -c: line 0: syntax error near unexpected token `('
    
    sh: -c: line 0: `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' /Users/myUser/dev/ReactExplorerApp(Android)/ios/Pods/RCT-Folly/folly/portability/Time.h'
    
    当我使用 XCode 构建应用程序时,我在 Time.h (...Pods/RCT-Folly/folly/portability/Time.h) 处收到以下错误消息:Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')该应用程序使用“react-native”:“0.66.1”。我正在使用 cocoapods 版本 1.11.2、节点版本 14.17.2 和 XCode 版本 13.1
    Podfile 内容:
    require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
    
    platform :ios, '11.0'
    
    target 'ExplorerApp' do
      config = use_native_modules!
      pod 'GoogleSignIn'
      pod 'RNI18n', :path => '../node_modules/react-native-i18n'
      pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'
      pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
        'FaceDetectorMLKit',
        'BarcodeDetectorMLKit'
      ]
    
      use_react_native!(
        :path => config[:reactNativePath],
        # to enable hermes on iOS, change `false` to `true` and then install pods
        :hermes_enabled => false
      )
    
    
      target 'ExplorerAppTests' 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_native_modules!
      use_flipper!()
    
      post_install do |installer|
        react_native_post_install(installer)
        __apply_Xcode_12_5_M1_post_install_workaround(installer)
      end
    end
    
    我尝试了许多类似问题的解决方案,但没有奏效。我尝试通过在 podfile 中将其注释掉来禁用 Flipper,并且我还尝试将目标更改为 iOS 12。
    我还尝试在删除 podfile.lock 并运行 pod install --repo-update 后安装 pod我也跑了pod cache clean --all我也在这里尝试了解决方案https://github.com/facebook/react-native/issues/31480对于 "react-native": "0.64.1" // or higher 但这对我不起作用,如果仍然存在错误,我不清楚他们所指的“从 podfile.lock 中删除相关行”是什么意思。

    Edit: [Solution] I got rid of this error by actually running git clone [repo url] in my terminal instead of using Azure DevOps's Clone button that interfaces with VSCode.

    最佳答案

    导航到该文件 => ios/Pods/RCT-Folly/folly/portability/Time.h评论此行 => typedef uint8_t clockid_t;更改 => _IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0_IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_02022 年 6 月更新的答案
    这可以通过在 post_install 下的 pod 文件中添加以下行来自动实现

    `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
    

    关于ios - Pods/RCT-Folly/folly/portability/Time.h 和不同类型的 Typedef 重新定义错误 ('uint8_t'(又名 'unsigned char')与 'enum clockid_t'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70357696/

    相关文章:

    c++ - Facebook folly::AccessSpreader 是如何工作的?

    ios - 当 tableview 使用自动布局滚动时避免粘性标题 View

    ios - Swift读取远程通知的userInfo

    ios - 有没有办法为 iOS 设备发送特定于用户的推送通知?

    react-native - ClojureScript重生开发中使用react-native-camera

    android - 在 react-native 项目中找不到 metro-config node_modules

    ios - Swift 1.2 (Xcode 6.3) 删除了 Bool 值的 xor '^' 运算符?

    react-native - 如何在 native react 中禁用键盘

    c++11 - 递归变量声明

    c++ - 何时使用愚蠢的单位类型