目前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應用是會有必定的性能損失,不過這種損失有多大缺少權威統計數據,我的認爲是不會影響用戶體驗的。