Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

john903

macrumors member
Original poster
Apr 11, 2008
66
0
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!
 

john903

macrumors member
Original poster
Apr 11, 2008
66
0
Those don't work for me either. Are these macros defined in a header file that I have to include?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
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.
 

john903

macrumors member
Original poster
Apr 11, 2008
66
0
Ok, I found the problem. The macros are detected correctly in my .mm files but not in my cpp files. Any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.