title: run-time vs. compile-time iPhone version check
body: <p>What's the difference between run-time, e.g., <code>[[UIDevice currentDevice] systemVersion]</code>, and compile-time, e.g., <code>__IPHONE_OS_VERSION_MIN_REQUIRED</code> checking? When should you one over the other?</p>
  
  <p>Is<code>__IPHONE_OS_VERSION_MIN_REQUIRED</code> just a variable set in Build Settings?</p>
  
  <p>I've read the answers to <a href="https://stackoverflow.com/questions/820142/how-to-target-a-specific-iphone-version">How to target a specific iPhone version?</a> and other related questions listed below.</p>
  
  <p>But, I just noticed that <code>__IPHONE_OS_VERSION_MIN_REQUIRED = 30200</code> when I build &amp; run on iPhone (4.3.1) with Xcode 4. Why?</p>
  
  <p>When you submit your code to Apple, do they compile a version of it for each version of the iPhone that exists, setting <code>__IPHONE_OS_VERSION_MIN_REQUIRED</code> accordingly?</p>
  
  <p>That way, you could inspect <code>__IPHONE_OS_VERSION_MIN_REQUIRED</code>, and know what iOS version is running the code.</p>
  
  <h3>Related Questions:</h3>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/3339722/check-iphone-ios-version">How to check iOS version?</a></li>
  <li><a href="https://stackoverflow.com/questions/3862933/check-ios-version-at-runtime">Check iOS version at runtime?</a></li>
  <li><a href="https://stackoverflow.com/questions/4056761/how-to-check-if-ios-version-supports-library">How to check if iOS version supports library?</a></li>
  </ul>