react-native iOS存档失败

时间:2018-11-29 18:16:55

标签: ios react-native archive

最近刚遇到此错误,因此在调试中进行工作即可。链接似乎是失败的地方:

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

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

1 个答案:

答案 0 :(得分: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