title: Use pragma ifdef to conditionally compile the same protocol header for both mac and ios?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3181321/which-conditional-compile-to-use-to-switch-between-mac-and-iphone-specific-code">Which conditional compile to use to switch between Mac and iPhone specific code?</a>  </p>
  </blockquote>
  
  
  
  <p>I've defined a protocol which should work just fine on both Mac and iOS.  However, one of the methods of the protocol would better return a specific class of object (rather than just 'id'), but the class is not a foundation class and thus varies on the two platforms (for example, UIButton and NSButton).</p>
  
  <p>How can I use a pragma mark like <code>#ifdef TARGET_OS_IPHONE</code> to include the same protocol header in two libraries, one built for iOS and one for Mac?</p>
  
  <p>Here is my actual protocol and my (broken) attempt at conditional compilation</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @protocol SharedAppDelegate &lt;NSObject&gt;
  
  #ifdef TARGET_OS_IPHONE
  @protocol UIApplicationDelegate;
  + (NSObject&lt;UIApplicationDelegate&gt; *)sharedAppDelegate;
  #else
  @protocol NSApplicationDelegate;
  + (NSObject&lt;NSApplicationDelegate&gt; *)sharedAppDelegate;
  #endif
  
  @end
  </code></pre>
  
  <p>One thing I know off the bat is that the target does not include the simulator, but I cannot find a solid example of one target which covers Mac and another all iOS incarnations.</p>