PDA

View Full Version : TARGET_OS_EMBEDDED and TARGET_OS_ASPEN




john903
Aug 4, 2008, 07:32 PM
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!



kainjow
Aug 4, 2008, 08:22 PM
You can use TARGET_IPHONE_SIMULATOR, TARGET_OS_IPHONE

john903
Aug 5, 2008, 09:51 AM
Those don't work for me either. Are these macros defined in a header file that I have to include?

kainjow
Aug 5, 2008, 11:43 AM
Make sure you use it like so:
#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
Aug 5, 2008, 03:20 PM
TARGET_IPHONE is actually what gets defined, not TARGET_OS_IPHONE

john903
Aug 5, 2008, 08:09 PM
Ok, I found the problem. The macros are detected correctly in my .mm files but not in my cpp files. Any ideas?

kainjow
Aug 6, 2008, 04:29 AM
You could try a #include <TargetConditionals.h>

john903
Aug 6, 2008, 09:51 AM
Thanks! Worked perfectly!