React Native 构建在 run-ios 上失败

问题描述 投票:0回答:1

自从 Xcode 更新到 12.5 以来,我一直无法运行我的 React Native 项目。我感觉问题出在 Flipper 上,但是当我从 Podfile 中注释掉 Flipper 时,其他模块也出现类似的错误。这是我安装 Flipper 时遇到的错误:

** BUILD FAILED **


The following build commands failed:
    CompileC /Users/mohammedibrahim/Library/Developer/Xcode/DerivedData/DinDin-cpajpwxpvpxihbgmxeemayoewtno/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/mohammedibrahim/Documents/code/dindin/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcode react-native cocoapods
1个回答
0
投票

只需这样更新你的 podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
        config.build_settings['DEVELOPMENT_TEAM'] = '662Y85Q9D6'
      end

      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.4'

      # **************Just add this line in your Podfile**************
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
    end
  end
end

或者在你的 ios\projectname\AppDelegate.m 中更新此代码

// From this
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

// To this
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];

可能这两种解决方案之一或两者都可以解决您的问题

参考资料:

https://github.com/facebook/react-native/issues/39568

https://github.com/facebook/react-native/issues/37748

© www.soinside.com 2019 - 2024. All rights reserved.