title: What is the preprocessor macro to test whether an application extension is being built?
body: <p>This question is based purely on publicly released documents regarding the introduction of application extensions in iOS.</p>
  
  <p>With the introduction of <a href="https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW1">app extensions</a> in iOS 8, it is now possible to "extend custom functionality and content beyond your app and make it available to users while they’re using other apps".</p>
  
  <p>In my implementation of my extension, I am including some classes from my actual app in my extension (models, etc). The problem is that these classes make calls to <code>UIApplication</code>, which is not available in an app extension, and the compiler tells me so.</p>
  
  <p>I thought an easy solution to this would to be enclose any calls to <code>UIApplication</code> in an <code>#if</code> directive.</p>
  
  <p>For example, if I wanted to only include code if I was running on a simulator, I would use:</p>
  
  <pre><code>#if TARGET_IPHONE_SIMULATOR
      // Code Here
  #endif
  </code></pre>
  
  <p>Is there a similar defined macro when the target is an application extension?</p>