React-Native Expo-IOS中的愚蠢问题

时间:2019-07-16 16:43:47

标签: xcode expo expo-33

在XCode中构建Exjected Expo33项目时,我们得到以下信息:(在Android中工作正常)。

Undefined symbols for architecture x86_64:
  "folly::dynamic::getDefault(folly::dynamic const&, folly::dynamic&&) const &", referenced from:
      facebook::react::JSCExecutor::initOnJSVMThread() in libReact.a(JSCExecutor.o)
  "folly::dynamic::at(folly::dynamic const&) const &", referenced from:
      folly::dynamic::operator[](folly::dynamic const&) const & in libReact.a(Value.o)
  "folly::dynamic::operator[](folly::dynamic const&) &", referenced from:
      facebook::react::ModuleRegistry::getConfig(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libReact.a(ModuleRegistry.o)
      facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int) in libReact.a(CxxNativeModule.o)
      facebook::react::parseMethodCalls(folly::dynamic&&) in libReact.a(MethodCall.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

通常,这指向一个有问题的Podspec文件,但与默认PodSpec文件相比,该PodSpec看起来很可靠(下面供参考)。

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'

target 'project-name' do
  pod 'ExpoKit',
    :git => "http://github.com/expo/expo.git",
    :tag => "ios/2.11.0",
    :subspecs => [
      "Core"
    ],
    :inhibit_warnings => true

   # Install unimodules
   require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
   use_unimodules!

  pod 'React',
    :path => "../node_modules/react-native",
    :inhibit_warnings => true,
    :subspecs => [
      "Core",
      "ART",
      "RCTActionSheet",
      "RCTAnimation",
      "RCTCameraRoll",
      "RCTGeolocation",
      "RCTImage",
      "RCTNetwork",
      "RCTText",
      "RCTVibration",
      "RCTWebSocket",
      "DevSupport",
      "CxxBridge"
    ]
  pod 'yoga',
    :path => "../node_modules/react-native/ReactCommon/yoga",
    :inhibit_warnings => true
  pod 'DoubleConversion',
    :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
    :inhibit_warnings => true
  pod 'Folly',
    :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
    :inhibit_warnings => true
  pod 'glog',
    :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
    :inhibit_warnings => true
  pod 'rn-fetch-blob',
    :path => '../node_modules/rn-fetch-blob'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  post_install do |installer|
    installer.pods_project.main_group.tab_width = '2';
    installer.pods_project.main_group.indent_width = '2';

    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end

      # It removes React & Yoga from the Pods project, as it is already included in the main project.
      targets_to_ignore = %w(React yoga)
      if targets_to_ignore.include? target.name
        target.remove_from_project
      end

    end

    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|

      if pod_name == 'ExpoKit'
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'

          # Enable Google Maps support
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS=1'
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS_UTILS=1'

        end
      end


      if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? pod_name
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
        end
      end

      # Can't specify this in the React podspec because we need to use those podspecs for detached
      # projects which don't reference ExponentCPP.
      if pod_name.start_with?('React')
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
          config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
        end
      end

      # Build React Native with RCT_DEV enabled and RCT_ENABLE_INSPECTOR and
      # RCT_ENABLE_PACKAGER_CONNECTION disabled
      next unless pod_name == 'React'
      target_installation_result.native_target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_ENABLE_INSPECTOR=0'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'ENABLE_PACKAGER_CONNECTION=0'
      end

    end
  end
end

0 个答案:

没有答案