TARGET_OS_EMBEDDED and TARGET_OS_ASPEN

Discussion in 'iPhone/iPad Programming' started by john903, Aug 4, 2008.

  1. macrumors member

    Joined:
    Apr 11, 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!
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    You can use TARGET_IPHONE_SIMULATOR, TARGET_OS_IPHONE
     
  3. thread starter macrumors member

    Joined:
    Apr 11, 2008
    #3
    Those don't work for me either. Are these macros defined in a header file that I have to include?
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #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.
     
  5. macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #5
    TARGET_IPHONE is actually what gets defined, not TARGET_OS_IPHONE
     
  6. thread starter macrumors member

    Joined:
    Apr 11, 2008
    #6
    Ok, I found the problem. The macros are detected correctly in my .mm files but not in my cpp files. Any ideas?
     
  7. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #7
    You could try a #include <TargetConditionals.h>
     
  8. thread starter macrumors member

    Joined:
    Apr 11, 2008
    #8
    Thanks! Worked perfectly!
     

Share This Page