iOS基础类

XCode File not found libarclite_

2023-08-13  本文已影响0人  Singularity_Lee

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

xcode 14.3更新后arc路径缺失导致pod的引用路径全部无法正常找到。这里需要重新创建该路径及文件或者将报错的 Cocopods 引入的库的最低版本改为 iOS 11.0即可。

1)重新创建arc路径及文件
cd 或者 open到该路径下

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

手动或者代码创建arc文件夹

sudo mkdir arc

从网上下载arc文件中将arc文件夹内容整体替换 或直接clone

cd  arc
sudo git clone https://github.com/kamyarelyasi/Libarclite-Files.git

最后给予权限即可

sudo chmod +x *

2)Podfile 中添加脚本 将Cocopods 引入的库的最低版本改为 iOS 11.0

  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'] = '11.0'
         end
      end
    end
  end

Undefined symbol: _OBJC_CLASS_$

M系列芯片运行,因当前编译版本无法匹配模拟器(比如项目中如果使用了某个静态库,而该静态库打包模拟器的时候并没有支持arm64j架构),pod文件报错无法找到相应文件,需要更改pod的运行的build设置才行

1)更改配置架构框架
Project -> buildSettings -> Excluded Architecturesarm64

2)Podfile 中添加脚本

  post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
      config.build_settings['VALID_ARCHS'] = 'arm64 arm64e armv7 armv7s x86_64 i386'
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
    end
  end

在M1芯片之前,模拟器是x86_64架构(更早的是i386),真机是arm系列,armv7,armv7s,arm64,arm64e这些.
制作静态库的时候,分别制作了模拟器和真机,Intel芯片制作的模拟器版本静态库是x86_64,而M1是arm64,
通常会把模拟器和真机的用lipo命令合在一起,并且合并的时候相同的架构是需要去掉一个的,通常我们去掉模拟器的arm64,因为去掉真机的,手机就不能编译了.
现在M1的mac制作的模拟器版本是arm64,真机也有arm64,就无法合并了,本来m1的模拟器就需要arm64的架构,现在删掉模拟器的arm64导致m1上的模拟器无法使用这个合并后的静态库.


pods 清除重装

pod deintegrate
pod install

或直接

pod deintegrate & pod install
上一篇下一篇

猜你喜欢

热点阅读