M1 Air 上的 React Native 无法为 iOS 构建

时间:2021-06-13 18:10:18

标签: ios reactjs react-native apple-m1

经过一段时间的中断(例如 2 个月左右)后,我要回到一个项目中,但尝试在我的 M1 Air 上运行我的应用程序失败。我已经使用 react-native-clean-project 在我尝试修复此问题的更改之间清理项目。

我在运行 react-native clean-project-auto 时确实得到了这个

Error running 'wipe iOS build artifacts': objc[39430]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1f1926c10) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x11bab82b8). One of the two will be used. Which one is undefined.
objc[39430]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1f1926c60) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x11bab8308). One of the two will be used. Which one is undefined.

Error running 'wipe iOS build artifacts': objc[39432]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1f1926c10) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1136902b8). One of the two will be used. Which one is undefined.

Error running 'wipe iOS build artifacts': objc[39432]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1f1926c60) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x113690308). One of the two will be used. Which one is undefined.

XCode 版本:12.5 反应原生版本:0.64.0

我得到的错误:

objc[37733]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1f1926c10) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1166cc2b8). One of the two will be used. Which one is undefined.
objc[37733]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1f1926c60) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1166cc308). One of the two will be used. Which one is undefined.
** BUILD FAILED **

The following build commands failed:
    CompileC /Users/kollinfrancis/Library/Developer/Xcode/DerivedData/KanjiDraw-ggmdygefcdmywmhkmjeavmfhuhel/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/ReactCommon.build/Objects-normal/x86_64/RCTTurboModuleManager.o /Users/kollinfrancis/Documents/Projects/KanjiDraw/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

我正在运行的命令: npm run ios

我的播客文件:

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

platform :ios, '13.0'

target 'X' do
  use_unimodules!
  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 'XTests' 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!({ 'Flipper' => '0.90.0', 'Flipper-Folly' => '2.6.7', 'Flipper-RSocket' => '1.4.3' })

  post_install do |installer|
    react_native_post_install(installer)
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end 
  end
end

1 个答案:

答案 0 :(得分:0)

在我的 podfile 中,我将 use_flipper 更新为

use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.1', 'Flipper-RSocket' => '1.3.1')

然后我将我的 react-native 从 0.64 更新为 0.64.1