xcode armv6 armv7 armv7s arm64指令集

郝萌主傾心貢獻,尊重作者的勞動成果,請勿轉載。

如果文章對您有所幫助,歡迎給作者捐贈,支持郝萌主,捐贈數額隨意,重在心意^_^ 

我要捐贈: 點擊捐贈

Cocos2d-X源碼下載:點我傳送


之前每個版本的ipa包打出來都才20M出頭,後來不知道從哪個版本起打的包每次都將近40M,但是工程中也沒有明顯的增加很大第三方類或者圖片、靜態文件。於是就開始了各種瘦身計劃:壓縮圖片,刪除不必要靜態庫。做了一番改動後發現包只比原來小了1M多,收效甚微。

其實是armv6 armv7 armv7s arm64引起編譯包翻倍增大的問題,試了一下,果然ipa包又回到了以前的大小。

下邊來說一下關於ios這個指令集:

目前ios的指令集有以下幾種:

  • armv6
    • iPhone
    • iPhone2
    • iPhone3G
    • 第一代和第二代iPod Touch
  • armv7
    • iPhone4
    • iPhone4S
  • armv7s
    • iPhone5
    • iPhone5C
  • arm64
    • iPhone5S

 機器對指令集的支持是向下兼容的,因此armv7的指令集是可以運行在iphone5S的,只是效率沒那麼高而已~

在xcodeTARGETS裏邊Architectures:


Architecture : 指你想支持的指令集。

Valid architectures : 指即將編譯的指令集。

Build Active Architecture Only : 只是否只編譯當前適用的指令集。

 現在4S的用戶還是蠻多的,而iphone3之類的機器幾乎沒有了,所以我們的指令集最低必須基於armv7。

因此,Architecture的值選擇:armv7 armv7arm64

PS:選arm64時需要最低支持5.1.1:

Convert Your App to a 64-Bit Binary After Updating It for iOS 7

Xcode 5.0.1 can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 5.1.1 or later. The 64-bit binary runs only on 64-bit devices running iOS 7.0.3 and later. If you have an existing app, you should first update your app for iOS 7 and then port it to run on 64-bit processors. By updating it first for iOS 7, you can remove deprecated code paths and use modern practices. If you’re creating a new app, target iOS 7 and compile 32-bit and 64-bit versions of your app.

The architecture for 64-bit apps on iOS is almost identical to the architecture for OS X apps, making it easy to create a common code base that runs in both operating systems. Converting a Cocoa Touch app to 64-bit follows a similar transition process as the one for Cocoa apps on OS X. Pointers and some common C types change from 32 bits to 64 bits. Code that relies on the NSInteger and CGFloat types needs to be carefully examined.

Start by building the app for the 64-bit runtime, fixing any warnings that occur as well as searching your code for specific 64-bit issues. For example:

  • Make sure all function calls have a proper prototype.

  • Avoid truncating 64-bit values by accidentally assigning them to a 32-bit data type.

  • Ensure that calculations are performed correctly in the 64-bit version of your app.

  • Create data structures whose layouts are identical in the 32-bit and 64-bit versions of your app (such as when you write a data file to iCloud).

1,如果想自己的app在各個機器都能夠最高效率的運行,則需要將Build Active Architecture Only改爲NO,Valid architectures選擇對應的指令集:armv7 armv7arm64。這個會爲各個指令集編譯對應的代碼,因此最後的 ipa體積基本翻了3倍,Release版本必須NO。

2,如果想讓app體積保持最小,則現階段應該選擇Valid architectures爲armv7,這樣Build Active Architecture Only選YES或NO就無所謂了

現在,官方提交APP必須支持64位了。

郝萌主傾心貢獻,尊重作者的勞動成果,請勿轉載。

如果文章對您有所幫助,歡迎給作者捐贈,支持郝萌主,捐贈數額隨意,重在心意^_^ 

我要捐贈: 點擊捐贈

Cocos2d-X源碼下載:點我傳送

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章