【问题标题】:React Native on M1 Air fails to build for iOSM1 Air 上的 React Native 无法为 iOS 构建
【发布时间】:2021-08-29 19:57:48
【问题描述】:

经过一段时间的中断(比如 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 React 原生版本: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

【问题讨论】:

  • 你可以尝试在xcode中运行它并从那里找到错误吗?
  • 嘿伙计,有什么更新吗?
  • 这里与默认的react-native-template-typescript 模板相同,没有任何变化。
  • @YuriToledo 检查我发布的答案。我就是这样解决的。
  • @FlorianFalk 检查我发布的答案。我就是这样解决的。

标签: ios reactjs react-native apple-m1


【解决方案1】:

在我的 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

【讨论】:

    猜你喜欢
    • 2021-05-11
    • 2021-12-11
    • 1970-01-01
    • 2022-08-22
    • 2019-02-20
    • 1970-01-01
    • 2021-11-10
    • 2021-10-20
    • 2017-09-09
    相关资源
    最近更新 更多