iosxcode64-bit

Compiling for 64/32 bit iOS


I'm trying to compile for 64 and 32 bit. I followed the instructions in Apple's transition guide:

https://developer.apple.com/library/ios/documentation/General/Conceptual/CocoaTouch64BitGuide/ConvertingYourAppto64-Bit/ConvertingYourAppto64-Bit.html#//apple_ref/doc/uid/TP40013501-CH3-SW1

and changed my architectures setting. If I changed Build Active Architecture Only to Yes, I get an error saying the architecture is not available. With it set to the settings below, it compiles successfully in the 64-bit iPhone simulator, but when I check it using the following block of code, it says it's still running 32-bit.

How do I properly set this up to run as 64-bit on 64-bit devices, and 32-bit on 32-bit devices?

#if __LP64__
    NSLog(@"64");
#else
    NSLog(@"32");
#endif


Solution

  • Set "valid architectures" to arm64, armv7 and armv7s (and i386, which is for the simulator) and you should be good to go.

    It looks like, from your screenshot, that "Architectures" is already set correctly (to "Standard architectures").

    If I set up a test project and drop those NSLog lines in and run them in the 64-bit iPhone simulator, I'll see "64" print out in the Xcode console.