对于IOS而言,模拟器并不运行arm的指令集,编译运行的是x86指令集。只有在IOS设备上,才会执行设备对应的arm指令集。
armv6设备:iPhone, iPhone2, iPhone 3G,第一代、第二代iPod Touch
armv7设备:iPhone 3GS, iPhone 4, iPhone 4S
iPad , iPad 2, the new iPad
iPod Touch 3G, iPod Touch 4
armv7s设备:iPhone 5
arm64:iphone 5s土豪金
注意:Xcode14开始苹果不支持armv7,iOS11开始也不支持armv7。需要生成支持armv7的SDK,需下载xcode14以下的版本就行生成。支持的iOS版本设置为iOS11以下
Xcode项目参数设置—— Architectures
- Valid architectures : 指即将编译的指令集。
- Build Active Architecture Only : 是否只编译当前适用的指令集。
当其值设置为YES,这个属性设置为yes,是为了debug的时候编译速度更快,它只编译当前的architecture版本,而设置为no时,会编译所有的版本。 所以,一般debug的时候可以选择设置为yes,release的时候要改为no,以适应不同设备。
项目设置的指令集最低必须基于armv7. 因此,Architecture的值选择:armv7 armv7s arm64(选arm64时需要最低支持5.1.1)
# Xcode14之后如何打出支持armv7架构的SDK
xcode14之前,默认支持armv7和arm64; xcode14开始,只支持arm64。xcode14无法生成支持armv7的SDK,需要下载低版本的Xcode去生成
注意:
用xcode14以下版本生成时,如果项目设置里默认是arm64和armv7,生成SDK后只有arm64。是SDK支持的最低版本是iOS11,而iOS11之后不支持armv7了,需支持iOS11以下版本才可以。
![](https://img.haomeiwen.com/i2988670/844d5b1bf98b93d8.jpg)
![](https://img.haomeiwen.com/i2988670/0e8ddda1c6530a69.jpg)
查看.framework或.a文件支持的架构
进去xxx.framework目录 xxx是framework的名字
cd /Users/apple/Library/Developer/Xcode/xxx.framework
查询
lipo -info xxx
执行结果:
Architectures in the fat file: xxx are: armv7 arm64
网友评论