J john903 macrumors member Original poster Apr 11, 2008 66 0 Aug 4, 2008 #1 I was using these macros to determine if I was in Mac or iPhone but they no longer work with the latest SDK. Does anyone know what macros I can use to determine what platform I am on in my code? Thanks!
I was using these macros to determine if I was in Mac or iPhone but they no longer work with the latest SDK. Does anyone know what macros I can use to determine what platform I am on in my code? Thanks!
K kainjow Moderator emeritus Jun 15, 2000 7,958 7 Aug 4, 2008 #2 You can use TARGET_IPHONE_SIMULATOR, TARGET_OS_IPHONE
J john903 macrumors member Original poster Apr 11, 2008 66 0 Aug 5, 2008 #3 Those don't work for me either. Are these macros defined in a header file that I have to include?
K kainjow Moderator emeritus Jun 15, 2000 7,958 7 Aug 5, 2008 #4 Make sure you use it like so: Code: #if (TARGET_IPHONE_SIMULATOR) // iPhone simulator code here.. #else // blah #endif They will always be defined (when compiling for the iPhone) so you can't just check for #ifdef.
Make sure you use it like so: Code: #if (TARGET_IPHONE_SIMULATOR) // iPhone simulator code here.. #else // blah #endif They will always be defined (when compiling for the iPhone) so you can't just check for #ifdef.
Sbrocket macrumors 65816 Jun 3, 2007 1,250 0 /dev/null Aug 5, 2008 #5 TARGET_IPHONE is actually what gets defined, not TARGET_OS_IPHONE
J john903 macrumors member Original poster Apr 11, 2008 66 0 Aug 5, 2008 #6 Ok, I found the problem. The macros are detected correctly in my .mm files but not in my cpp files. Any ideas?
Ok, I found the problem. The macros are detected correctly in my .mm files but not in my cpp files. Any ideas?
K kainjow Moderator emeritus Jun 15, 2000 7,958 7 Aug 6, 2008 #7 You could try a #include <TargetConditionals.h>
J john903 macrumors member Original poster Apr 11, 2008 66 0 Aug 6, 2008 #8 Thanks! Worked perfectly!