目前ios的指令集有如下几种:php
机器对指令集的支持是向下兼容的,所以armv7的指令集是能够运行在iphone5S的,只是效率没那么高而已~html
================================================ios
Architecture : 指你想支持的指令集。xcode
Valid architectures : 指即将编译的指令集。app
Build Active Architecture Only : 只是否只编译当前适用的指令集。iphone
================================================ide
如今是2014年初,其实4和4S的用户仍是蛮多的,而iphone3之类的机器几乎没有了,因此咱们的指令集最低必须基于armv7.工具
所以,Architecture的值选择:armv7 armv7s arm64性能
PS:选arm64时须要最低支持5.1.1:ui
1,若是想本身的app在各个机器都可以最高效率的运行,则须要将Build Active Architecture Only改成NO,Valid architectures选择对应的指令集:armv7 armv7s arm64。这个会为各个指令集编译对应的代码,所以最后的 ipa体积基本翻了3倍,Release版本必须NO。
2,若是想让app体积保持最小,则现阶段应该选择Valid architectures为armv7,这样Build Active Architecture Only选YES或NO就无所谓了
参考文章:http://blog.csdn.net/oskytonight/article/details/22319853
Xcode中关于生成二进制包指令集相关的设置项有如下三个:
官方文档说明:
Space-separated list of identifiers. Specifies the architectures (ABIs, processor models) to which the binary is targeted. When this build setting specifies more than one architecture, the generated binary may contain object code for each of the specified architectures. |
改变以选项指定了工程将被编译成支持哪些指令集,支持指令集是经过编译生成对应的二进制数据包实现的,若是支持的指令集数目有多个,就会编译出包含多个指令集代码的数据包,形成最终编译的包很大。
官方文档说明:
Space-separated list of identifiers. Specifies the architectures for which the binary may be built. During the build, this list is intersected with the value of ARCHS build setting; the resulting list specifies the architectures the binary can run on. If the resulting architecture list is empty, the target generates no binary. |
该编译项指定可能支持的指令集,该列表和Architectures列表的交集,将是Xcode最终生成二进制包所支持的指令集。
好比,你的Valid Architectures
设置的支持arm指令集版本有:armv7/armv7s/arm64
,对应的Architectures
设置的支持arm指令集版本有:armv7s
,这时Xcode只会生成一个armv7s
指令集的二进制包。
官方文档说明:
Boolean value. Specifies whether the product includes only object code for the native architecture. |
该编译项用于设置是否只编译当前使用的设备对应的arm指令集。
当该选项设置成YES时,你连上一个armv7
指令集的设备,就算你的Valid Architectures
和Architectures
都设置成armv7/armv7s/arm64
,仍是依然只会生成一个armv7
指令集的二进制包。
固然该选项起做用的前提是你的Xcode必须成功链接了调试设备。若是你没有任何活跃设备,即Xcode没有成功链接调试设备,就算该设置项设置成YES依然还会编译Valid Architectures
和Architectures
指定的二进制包。
一般状况下,该编译选项在Debug模式都设成YES,Release模式都设成NO。
好比,你的设备是armv7s指令集,那么它也能够兼容运行比armv7s版本低的指令集:armv七、armv6
Xcode4.5起再也不支持armv6,Xcode4.5的release notes中明确指出:
ChangesGeneral: iOSThis version of Xcode does not generate armv6 binaries. 12282156The minimum deployment target is iOS 4.3. 12282166 |
若是你的软件对安装包大小很是敏感,你能够减小安装包中的指令集数据包,并且这能达到立竿见影的效果。
咱们的项目以前支持的指令集是armv7/armv7s,后来改为只支持armv7后,比原来小了10MB左右。目前AppStore上的一些知名应用,好比百度地图
、腾讯地图
经过反汇编工具查看后,也都只支持armv7指令集。
根据向下兼容原则,armv7指令集的应用是能够正常在支持armv7s/arm64指令集的机器上运行的。
不过对于armv7s/arm64指令集设备来讲,使用运行armv7应用是会有必定的性能损失,不过这种损失有多大缺少权威统计数据,我的认为是不会影响用户体验的。