clang: error: SDK does not contain 'libarclite' at the path

回答 2 浏览 2998 2023-09-20

更新到 Xcode 15 后,我在尝试构建 React-native 应用程序时收到以下错误。

clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a'; try increasing the minimum deployment target

最低部署目标是13.0

这是我的Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
$RNMapboxMapsImpl = 'mapbox'

platform :ios, '13.0'

target 'MyProject' do
  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
  )

  # ADDED BY ME 
  def __apply_Xcode_14_3_RC_post_install_workaround(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']  = '13.0'
        # minimum_target = 13.0 
        # if current_target.to_f < minimum_target.to_f
        #   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target
        # end
      end
    end
  end
 # ADDED Y ME TO FINSH HE ISSUE

  pod 'Google-Mobile-Ads-SDK' ,"9.14.0"
  pod 'GoogleMobileAdsMediationFacebook','6.11.0.0'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'RNIap', :path => '../node_modules/react-native-iap'
  # permissions
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'react-native-contacts', :path => '../node_modules/react-native-contacts'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'RNExitApp', :path => '../node_modules/react-native-exit-app'

  target 'NumberLocatorTests' 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!()

  pre_install do |installer|
    $RNMBGL.pre_install(installer)
  end
  
  post_install do |installer|
    react_native_post_install(installer)
    $RNMBGL.post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    __apply_Xcode_14_3_RC_post_install_workaround(installer)
  end
end

这是我的 package.json 文件

 "react": "17.0.2",
 "react-native": "0.66.1",
Engr.Aftab Ufaq 提问于2023-09-20
有什么解决办法Iftikhar Hussain Orakzai 2023-09-20
2 个回答
#1楼 已采纳
得票数 11

问题出在 Cocoapods 项目的最低操作系统版本上。 只需进入项目导航器并选择 pods 项目:

  • 选择所有已安装的 Pod
  • 将 iOS 部署目标至少更改为 iOS 13

之后应该可以工作。

enter image description here

Joaquin Pereira 提问于2023-09-20
Joaquin Pereira 修改于2023-09-20
带有 Xcode 14 的 iOS 11 和带有 Xcode 15 的 iOS 12 也很好。Paul Beusterien 2023-09-23
#2楼
得票数 1

没有什么对我有用。在我像这样更改 Podfile 后,它再次开始工作。不明白这一点,但最终它运行并成功发布。

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
$RNMapboxMapsImpl = 'mapbox'

platform :ios, '13.0'

target 'MyProject' do
  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
  )

  # REMOVE THESE LINES
  #def __apply_Xcode_14_3_RC_post_install_workaround(installer)
    #installer.pods_project.targets.each do |target|
      #target.build_configurations.each do |config|
        #current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']  = '13.0'
        # minimum_target = 13.0 
        # if current_target.to_f < minimum_target.to_f
        #   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target
        # end
      #end
    #end
  #end
 # The upper line are removed and it start working 

  pod 'Google-Mobile-Ads-SDK' ,"9.14.0"
  pod 'GoogleMobileAdsMediationFacebook','6.11.0.0'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'RNIap', :path => '../node_modules/react-native-iap'
  # permissions
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'react-native-contacts', :path => '../node_modules/react-native-contacts'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'RNExitApp', :path => '../node_modules/react-native-exit-app'

  target 'NumberLocatorTests' 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!()

  pre_install do |installer|
    $RNMBGL.pre_install(installer)
  end
  
  post_install do |installer|
    react_native_post_install(installer)
    $RNMBGL.post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    #__apply_Xcode_14_3_RC_post_install_workaround(installer) removed this line
  end
end
Engr.Aftab Ufaq 提问于2023-09-21