title: Which conditional compile to use to switch between Mac and iPhone specific code?
body: <p>I am working on a project that includes a Mac application and an iPad application that share code.  How can I use conditional compile switches to exclude Mac-specific code from the iPhone project and vice-versa?  I've noticed that <code>TARGET_OS_IPHONE</code> and <code>TARGET_OS_MAC</code> are both 1, and so they are both always true.  Is there another switch I can use that will only return true when compiling for a specific target?</p>
  
  <p>For the most part, I've gotten the files to cooperate by moving <code>#include &lt;UIKit/UIKit.h&gt;</code> and <code>#include &lt;Cocoa/Cocoa.h&gt;</code> into the precompile headers for the two projects.  I'm sharing models and some utility code that fetches data from RSS feeds and Evernote.  </p>
  
  <p>In particular, the <code>[NSData dataWithContentsOfURL:options:error:]</code> function takes a different constant for the options parameter iOS 3.2 and earlier and Mac OS 10.5 and earlier than it does for iOS 4 and Mac OS 10.6.  The conditional I'm using is:</p>
  
  <p><code>#if (TARGET_OS_IPHONE &amp;&amp; (__IPHONE_OS_VERSION_MAX_ALLOWED &gt; __IPHONE_3_2)) || (TARGET_OS_MAC &amp;&amp; (MAC_OS_X_VERSION_MIN_REQUIRED &gt; MAC_OS_X_VERSION_10_5))</code></p>
  
  <p>This seems to work, but I want to make sure this is bulletproof.  My understanding is that if the Mac version is set to 10.6, but the iOS version is set to 3.2, it will still use the new constants even if it's compiling for iOS 3.2, which seems incorrect.</p>
  
  <p>Thanks in advance for any help!</p>