react-native iOS存档失败

Posted

技术标签:

【中文标题】react-native iOS存档失败【英文标题】:react-native iOS Archiving failure 【发布时间】:2018-11-29 18:16:55 【问题描述】:

最近才遇到这个错误,在调试中构建工作正常。链接似乎是失败的地方:

Undefined symbols for architecture armv7:
  "facebook::react::parseTypeFromHeader(facebook::react::BundleHeader const&)", referenced from:
      +[RCTjavascriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in libReact.a(RCTJavaScriptLoader.o)
  "_JSNoBytecodeFileFormatVersion", referenced from:
      +[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] in libReact.a(RCTJavaScriptLoader.o)
      +[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in libReact.a(RCTJavaScriptLoader.o)
  "_OBJC_CLASS_$_RCTCxxBridge", referenced from:
      objc-class-ref in libReact.a(RCTBridge.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的图书馆:

ios Build Phases Libraries

我的豆荚:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'BonggaKaDay' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for BonggaKaDay

  pod 'Firebase/Core', '~> 5.7.0'
  pod 'Firebase/Functions', '~> 5.7.0'
  pod 'Firebase/Auth', '~> 5.7.0'
  pod 'Firebase/Firestore', '~> 5.7.0'
  pod 'Firebase/Messaging', '~> 5.7.0'
  pod 'Firebase/AdMob', '~> 5.7.0'
  pod 'FBAudienceNetwork'
  pod 'RNSVG', :path => '../node_modules/react-native-svg'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
        'RCTImage' # <-- Add RCTImage
    ]
  pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
end

我不确定错误在哪里。请帮忙。

【问题讨论】:

你看过这个issue 吗?希望对你有帮助。 你看过这个issue吗?希望对你有帮助。 【参考方案1】:

将此添加到您的 podfile:

post_install do |installer|
      installer.pods_project.targets.each do |target|

          # The following is needed to ensure the "archive" step works in XCode.
          # It removes React & Yoga from the Pods project, as it is already included in the main project.
          # Without this, you'd see errors when you archive like:
          # "Multiple commands produce ... libReact.a"
          # "Multiple commands produce ... libyoga.a"

          targets_to_ignore = %w(React yoga)

          if targets_to_ignore.include? target.name
              target.remove_from_project
          end

      end
  end

谢谢@Takitaha

【讨论】:

以上是关于react-native iOS存档失败的主要内容,如果未能解决你的问题,请参考以下文章

react-native 0.57 run-ios 失败解决办法

React Native,AwesomeProject,react-native run-ios:** 构建失败 **

React-native IOS:网络请求失败

react-native run-ios 不断失败

react-native蓝牙连接失败:java.io.IOException读取失败,套接字可能关闭或超时,读取ret:-1

react-native run-ios 构建失败:CompileC RCTBaseTextInputView.o