背景

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,代码如下:

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设置比较低的三方库,会导致咱们提交私有组件时,也报如下过错

 /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,然后依靠咱们自己的私有组件

计划二

  • 翻开URL github.com/kamyarelyas… ,下载libarclite_iphonesimulator.a 文件至本地文件目录

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

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

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

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

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

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