做者:shede333
主頁:http://my.oschina.net/shede333
版權聲明:原創文章,版權聲明:自由轉載-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0html
這表明,在這個項目裏你想要Xcode編譯的目標設備列表。ios
還不是太明確這個設置的意圖,可是通常來講是不須要更改的。git
在Xcode5.0裏的 Valid Architectures 設置裏,有2個選項:github
standard architectures (including 64-bit)(armv7,armv7s,arm64)
,這樣設置,你的Deployment target最低只能設置爲 6.0,(在Xcode5.0.1 以後,最低可以兼容IOS 5.1.1);standard architectures (armv7,armv7s)
,這樣設置,你的Deployment target最低能設置爲 4.3;使用 standard architectures (including 64-bit)(armv7,armv7s,arm64) 參數, 則打的包裏面有32位、64位兩份代碼, 在iPhone5s(iPhone5s的cpu是64位的
)下,會首選運行64位代碼包, 其他的iPhone(其他iPhone都是32位的,iPhone5c也是32位
), 只能運行32位包, 可是包含兩種架構的代碼包,只有運行在ios6,ios7系統上。 這也就是說,這種打包方式,對手機幾乎沒啥要求,可是對系統有要求,即ios6以上。xcode
而使用 standard architectures (armv7,armv7s) 參數, 則打的包裏只有32位代碼, iPhone5s的cpu是64位,可是能夠兼容32位代碼,便可以運行32位代碼。可是這會下降iPhone5s的性能,緣由下面的參考有解釋。
其他的iPhone對32位代碼包更沒問題, 而32位代碼包,對系統也幾乎也沒什麼限制。架構
因此 總結 以下:
要發揮iPhone5s的64位性能,就要包含64位包,那麼系統最低要求爲ios6。
若是要兼容ios5以及更低的系統,只能打32位的包,系統都能通用,可是會喪失iPhone5s的性能。app
armv6:iPhone 2G/3G,iPod 1G/2G
armv7:iPhone 3GS/4/4s,iPod 3G/4G,iPad 1G/2G/3G ,iPad Mini 1 armv7s:iPhone5 ,iPhone5C ,iPad4 armv8:iPhone5S ,iPad5(iPad Air), iPad Mini 2(iPad Mini Retina)ide
Xcode 5編譯的iOS 7程序包含了32位和64位兩套二進制代碼,在32位的iOS系統上會調用32位的二進制代碼,在64位系統上會調用64位的二進制代碼,以此來解決向後兼容的問題。post
同時,考慮到不少32位的程序可能在沒有從新編譯的狀況下部署到64位系統上,64位的iOS系統中帶有兩套FrameWork,一套是32位的,一套是64位的。 當64位的iOS系統運行原來的32位程序時,系統會調用32位的FrameWork做爲底層支撐,當系統運行64位程序時,系統會調用64位的FrameWork做爲底層支撐。性能
也就是說,當一個iPhone 5S上同時運行32位程序和64位程序時,系統同時將32位和64位兩套FrameWork載入了內存中,因此消耗的內存也比較多。
若是一臺64位的iOS設備上運行的全部程序都是爲64位系統編譯過的,iOS系統將只載入64位的FrameWork,這將節省好多內存。因此,若是你們均可以快速將程序傳換成64位的,iOS將跑得更快。真的是「你們好纔是真的好」。
Architectures are the ones you want to build, valid architectures are the ones you could conceive of building with your codebase.
So maybe you only want to build your binary for armv7s, but the same source code would compile fine for armv7 and armv6. So VALID_ARCHS = armv6 armv7 armv7s
, but you set ARCHS = armv7s
because that's all you actually want to build with your code.
Or, in Apple-ese:
ARCHS (Architectures)
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.
and:
VALID_ARCHS (Valid 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.
Source: Xcode Build Setting Reference
In practice, you leave VALID_ARCHS
alone and don't worry about changing it, and just fiddle with ARCHS
to set the architectures you want to build. Typically, you set a Debug build to just NATIVE_ARCH
, since you only want to build the debug version for the machine you'll be testing/running it on, and Release builds for the full spectrum of architectures you plan to support.
Set the architecture in build setting to Standard architectures(armv7,armv7s)
iPhone 5S is powered by A7 64bit processor. From apple docs
Xcode can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 7 or later.
Note: A future version of Xcode will let you create a single app that supports the 32-bit runtime on iOS 6 and later, and that supports the 64-bit runtime on iOS 7.
From the documentation what i understood is
Update (Xcode 5.0.1)
In Xcode 5.0.1 they added the support to create 64 bit binary for iOS 5.1.1 onwards.
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.
Update (Xcode 5.1)
Xcode 5.1 made significant change in the architecture section. This answer will be a followup for you. Check this
OP is posted the solution along with the question itself. But I feel it would be better to add it as an answer. In Xcode 5.1
apple made significant changes to the architecture
section. They made arm64
as part of Standard architectures. That means the projects using the default setting will be automatically build for arm64
also. So what you will do if your app does not support arm64
?.
Doc says:
Projects not able to support 64-bit need to specifically set the architectures build setting to not include 64-bit.
How to do that?
Goto Targets-->Build Settings-->Architectures-->Architectures
Double click on the architecture will popup a menu. Choose others