Xcode 5 and iOS 7: Architecture and Valid architectures
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
- Xcode can create both 64bit 32bit binaries for a single app but thedeployment target should be iOS7. They are saying in future it willbe iOS 6.0
- 32 bit binary will work fine in iPhone 5S(64 bit processor).
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
My understanding from Apple Docs.
- What is Architectures (ARCHS) into Xcode build-settings?
- Specifies architecture/s to which the binary is TARGETED. When specified more that one architecture, the generated binary may contain object code for each of the specified architecture.
What is Valid Architectures (VALID_ARCHS) into Xcode build-settings?
- Specifies architecture/s for which the binary may be BUILT.
- During build process, this list is intersected with ARCHS and the resulting list specifies the architectures the binary can run on.
Example :- One iOS project has following build-settings into Xcode.
- ARCHS = armv7 armv7s
- VALID_ARCHS = armv7 armv7s arm64
- In this case, binary will be built for armv7 armv7s arm64 architectures. But the same binary will run on ONLY ARCHS = armv7 armv7s.
When you set 64-bit the resulting binary is a "Fat" binary, which contains all three Mach-O images bundled with a thin fat header. You can see that using otool or jtool. You can check out some fat binaries included as part of the iOS 7.0 SDK, for example the AVFoundation Framework, like so:
% cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport/7.0\ \(11A465\)/Symbols/System/Library/Frameworks/AVFoundation.framework/%otool -V -f AVFoundation 9:36Fat headersfat_magic FAT_MAGICnfat_arch 3architecture arm64 # The 64-bit version (A7) cputype CPU_TYPE_ARM64 cpusubtype CPU_SUBTYPE_ARM64_ALL capabilities 0x0 offset 16384 size 2329888 align 2^14 (16384)architecture armv7 # A5X - packaged after the arm64version cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7 capabilities 0x0 offset 2359296 size 2046336 align 2^14 (16384)architecture armv7s # A6 - packaged after the armv7 version cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7S capabilities 0x0 offset 4407296 size 2046176 align 2^14 (16384)
As for the binary itself, it uses the ARM64 bit instruction set, which is (mostly compatible with 32-bit, but) a totally different instruction set. This is especially important for graphics program (using NEON instructions and registers). Likewise, the CPU has more registers, which makes quite an impact on program speed. There's an interesting discussion in http://blogs.barrons.com/techtraderdaily/2013/09/19/apple-the-64-bit-question/?mod=yahoobarrons on whether or not this makes a difference; benchmarking tests have so far clearly indicated that it does.
Using otool -tV will dump the assembly (if you have XCode 5 and later), and then you can see the instruction set differences for yourself. Most (but not all) developers will remain agnostic to the changes, as for the most part they do not directly affect Obj-C (CG* APIs notwithstanding), and have to do more with low level pointer handling. The compiler will work its magic and optimizations.