Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling for 64/32 bit iOS

Tags:

xcode

ios

64-bit

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

like image 369
Chris Avatar asked May 31 '26 09:05

Chris


1 Answers

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.

like image 105
Michael Dautermann Avatar answered Jun 03 '26 02:06

Michael Dautermann