title: How to compile a section in Prefix.pch of a Xcode project once?
body: <p>The <code>Prefix.pch</code> as below.</p>
  
  <pre><code>#ifdef __OBJC__
  
  #import &lt;Foundation/Foundation.h&gt;
  
  #define BUNDLE_NAME XXXBundle
  #define LOADER_CLASS XXXBundleLoader
  
  extern NSBundle *BUNDLE_NAME;
  #undef NSLocalizedString
  #define NSLocalizedString(key, comment) [BUNDLE_NAME localizedStringForKey:(key) value:@"" table:nil]
  
  #ifdef RUN_ONCE
  
  NSBundle *BUNDLE_NAME;
  
  @interface LOADER_CLASS : NSObject @end
  
  @implementation LOADER_CLASS
  
  + (void)load
  {
    static dispatch_once_t onceToken;
    dispatch_once(&amp;onceToken, ^{
      BUNDLE_NAME = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"CXAFMResources" withExtension:@"bundle"]];
    });
  }
  
  @end
  
  #endif
  
  #endif
  </code></pre>
  
  <p><code>.pch</code> will be added to the header of every <code>.m</code> file, so Class define here will compile multiple times without defining <code>RUN_ONCE</code>, but what I need is let this <code>RUN_ONCE</code> section compile only one time. I add a compiler flag <code>-DRUN_ONCE</code> to a <code>.m</code> file of my project to solve this. I wonder if there is a one-step solution for the <code>#ifdef RUN_ONCE</code> that don't need to add flag?</p>
  
  <p>No, I don't want another <code>.m</code> file. I want to keep this snippet works by only copying to another <code>.pch</code>.</p>