iphone, system, How to find out if your iPhone app is running in the iPhone Simulator 如何知道程式是跑在 磨梨器 還是實際的iphone 上
How to find out if your iPhone app is running in the iPhone Simulator
Checking for the Simulator is pretty simple, as shown in the code below.
#if TARGET_IPHONE_SIMULATOR
NSString *hello = @”Hello, iPhone simulator!”;
#elif TARGET_OS_IPHONE
NSString *hello = @”Hello, device!”;
#else
NSString *hello = @”Hello, unknown target!”;
#endif