user1173142 user1173142 - 1 year ago 120
iOS Question

How to detect app is running on simulator or device

Possible Duplicate:

Programmatically detect if app is being run on device or simulator

How can I detect whether my app is running on Simulator or on Device via code.

Answer Source

Keep in mind UIDevice provides you already with information about the device itself.

[[UIDevice currentDevice] model]

You can also use the following:

TARGET_IPHONE_SIMULATOR tells you if you're in the iPhone simulator.

TARGET_OS_IPHONE tells you that you're working on the iPhone instead of MacOS.


    NSLog(@"Running in Simulator - no app store or giro");


    NSLog(@"Running on the Device");


and when ONLY interested in the device


    NSLog(@"Running on device");

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download