xcode指令集設定,xcode指令集

來源:互聯網
上載者:User

xcode指令集設定,xcode指令集

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

i386:mac
armv6:iPhone,iPhone2,iPhone3G,第一代和第二代iPod Touch
armv7:iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, iPad Mini 
armv7s:iPhone5,iPhone5C, iPad 4 
ARMv8/ARM64: iPhone 6(Plus), iPhone 5s, iPad Air(2), Retina iPad Mini(2,3)

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

************************************************************************

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

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

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

************************************************************************

 現在是2014年初,其實4和4S的使用者還是蠻多的,而iphone3之類的機器幾乎沒有了,所以我們的指令集最低必須基於armv7.

因此,Architecture的值選擇:armv7 armv7s arm64

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 armv7s arm64。這個會為各個指令集編譯對應的代碼,因此最後的 ipa體積基本翻了3倍,Release版本必須NO。

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


對於64位的支援


蘋果明年2月強制64位支援


對於支援64-bit,我們可以設定Architectures為 Standard architectures,在最新的Xcode 6上,它包括 armv7和arm64。

讓App支援32-bit和64-bit基本步驟

1.確保Xcode版本號碼>=5.0.1

2.更新project settings, minimum deployment target >= 5.1.1

3.改變Architectures為 Standard architectures(include 64-bit)

4.運行測試代碼,解決編譯warnings and errors,對照本文檔或者官方文檔 64-Bit Transition Guide for Cocoa Touch對相應地方做出修改。(編譯器不能告訴我們一切)

5.在真實的64-bit機器上測試。

6.使用Instruments查看記憶體使用量問題。

64-bit主要的變化

64-bit運行時環境和32-bit運行時環境主要有以下兩點的不同:

資料類型的改變

方法調用上的改變

資料類型的改變


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.