How does one get UI_USER_INTERFACE_IDIOM() to work with iPhone OS SDK < 3.2

I do this to get the code to compile in both 3.1.3 and 3.2: BOOL iPad = NO; #ifdef UI_USER_INTERFACE_IDIOM iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); #endif if (iPad) { // iPad specific code here } else { // iPhone/iPod specific code here } I also wrote a quick blog post about it here: http://www.programbles.com/2010/04/03/compiling-conditional-code-in-universal-iphone-ipad-applications/