3

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

Chris
  • 7,270
  • 19
  • 66
  • 110

1 Answers1

2

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.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • That makes sense, thanks. I think it worked for me, I just go new errors from a couple third party libraries saying they're `missing required architecture x86_64`. Do you know the difference between `Architectures` and `Valid Architectures`? It seems a bit redundant to me – Chris Jan 09 '14 at 20:34
  • The difference between architectures and valid architectures can be [found in this question](http://stackoverflow.com/questions/12701188/whats-the-difference-between-architectures-and-valid-architectures-in-xcode). – Michael Dautermann Jan 09 '14 at 20:38