【问题标题】:How to fix error React Native 'UMCore' build error in Xcode如何修复 Xcode 中的错误 React Native 'UMCore' 构建错误
【发布时间】:2019-08-21 17:16:55
【问题描述】:

我正在将我的 Expo 应用程序弹出到 Expo Kit。 我是通过运行 expo eject 来实现的,它生成了 ios 和 android 文件。

当我按照this 指南运行我的项目时,我运行expo start,expo 将在客户端上运行应用程序。 但是,当我尝试关注step 3 时,我遇到了问题。

我将进入我的 ios 目录并像这样运行pod install

cd ./ios
pod install

之后,我打开 Xcode 并点击“运行”按钮。

几秒钟后,构建失败并出现 3 个错误。 看起来是这样的:

如您所见,所有这些错误似乎都来自名为“UMCore”的开发 Pod。

我已尝试删除所有 pod 并使用 pod install 重新安装它们,以及更新 cocoapods 并再次运行,但问题仍然存在。

这就是我的 Podfile 的样子

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

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

  # Install unimodules
  require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
  use_unimodules!(
    modules_paths: ['../node_modules'],
    exclude: [
      'expo-face-detector',
      'expo-payments-stripe',
    ],
  )

  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


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

    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

工具版本:

  • Cocoapods 1.7.5

  • Expo-CLI 3.0.6

  • React-Native:0.59.8

【问题讨论】:

    标签: ios xcode react-native cocoapods expo


    【解决方案1】:

    将 Xcode 更新到版本 10 解决了这个问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-16
      • 1970-01-01
      • 2020-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 2017-12-03
      相关资源
      最近更新 更多