Problem description
In general projects, macro definitions can be used to determine whether the simulator is a real machine, which is undoubtedly effective.
# If target_iphone_simulator # define simulator 1 # Elif target_ OS _iphone # define simulator 0 # endif
However, macros work during pre-compilation. Can macro definitions be used in static libraries to distinguish between simulators and real machines?
Analysis ideas
Macro definition does work during pre-compilation, but the static library is compiled. file a is usually divided into two types: simulator and real machine. It is merged into fat by using lipo in a timely manner. file A, which is used to run the call. file a is not the same.
Verification and conclusion
Through test and verification, the aboveCodeIt is indeed capable of distinguishing between the simulator and the real machine, that is, the macro definition can be used in the static library to distinguish between the iPhone simulator and the real machine