Home > Articles > Operating Systems, Server > MAC OS X/Other

  • Print
  • + Share This
This chapter is from the book

Detecting Simulator Builds with Compile-Time Checks

Xcode directives issue instructions to the compiler that can detect the platform you’re building for. This lets you customize your application to safely take advantage of device-only features when they’re available. Adding #if statements to your code lets you block or reveal functionality based on these options. To detect if your code is compiled for the simulator or for an iOS device, use a compile-time check:


    Code specific to simulator


    Code specific to iPhone

  • + Share This
  • 🔖 Save To Your Account