iOS pod repo push 报错 ld: file not found: libarclite_iphoneos.a 问题解决方案

背景

Xcode 升级 14.3 之后,在Xcode 运行项目会收到以下错误

File not found: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a

项目中可以通过以下方法解决编译错误,就是在 Podfile 中,设置IPHONEOS_DEPLOYMENT_TARGET,代码如下:

swift 复制代码
post_install do |installer|
    installer.generated_projects.each do |project|
          project.targets.each do |target|
              target.build_configurations.each do |config|
                  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
               end
          end
   end
end

但是因为项目中有一些私有组件,也引用了一些minimum deployment设置比较低的三方库,会导致我们提交私有组件时,也报如下错误

swift 复制代码
 /App-exxigwycpikvlpgzpmccfjpmuvkx/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/YYCategories.build/Objects-normal/x86_64/Binary/YYCategories
    ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
 ** BUILD FAILED **
    The following build commands failed:
    	Ld /Users/mengruirui/Library/Developer/Xcode/DerivedData/App-exxigwycpikvlpgzpmccfjpmuvkx/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/YYCategories.build/Objects-normal/x86_64/Binary/YYCategories normal x86_64 (in target 'YYCategories' from project 'Pods')
    (1 failure)

解决

方案一

将第三方组件克隆一份放到本地私有仓,修改 minimum deployment,然后依赖我们自己的私有组件

方案二

  • 打开 Mac 上的 Finder 应用程序,在菜单中找到前往 -> 前往文件夹 输入以下地址,然后前往

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib

  • 在该目录下面查看是否有arc文件夹,如果没有该文件夹,则新建文件夹,命名为arc

  • 将下载好的libarclite_iphonesimulator.a 文件,拷贝到arc 文件夹下面

相关推荐
imLix10 小时前
RunLoop 实现原理
前端·ios
归辞...16 小时前
「iOS」————设计架构
ios·架构
i紸定i20 小时前
解决html-to-image在 ios 上dom里面的图片不显示出来
前端·ios·vue·html·html-to-image
YungFan1 天前
iOS26适配指南之UIButton
ios·swift
红橙Darren2 天前
手写操作系统 - 编译链接与运行
android·ios·客户端
鹏多多.2 天前
flutter-使用device_info_plus获取手机设备信息完整指南
android·前端·flutter·ios·数据分析·前端框架
麦兜*2 天前
【swift】SwiftUI动画卡顿全解:GeometryReader滥用检测与Canvas绘制替代方案
服务器·ios·swiftui·android studio·objective-c·ai编程·swift
GeniuswongAir3 天前
iOS 26 一键登录失效:三大运营商 SDK 无法正常获取手机号
ios
吴Wu涛涛涛涛涛Tao3 天前
Flutter 实现类似抖音/TikTok 的竖向滑动短视频播放器
android·flutter·ios