2

There are somethings that don't work correctly in the simulator. I'd like exclude them during my development when I'm on the simulator. Is there any way programmatically I can tell if the code is running in the simulator or not.

Saviz
  • 677
  • 6
  • 19
  • try answers here. They are for iPhone but see if you can extend them for Apple Watch. http://stackoverflow.com/questions/458304/how-can-i-programmatically-determine-if-my-app-is-running-in-the-iphone-simulato – Sam B Jan 26 '16 at 03:28

1 Answers1

1

I just tried this in watchKit.

    NSString *modelNameStr = [[WKInterfaceDevice currentDevice] name];
    NSLog(@"modelNameStr: %@ ...", modelNameStr);

    if ([modelNameStr isEqualToString:@"MacBookPro2012"]) {
        //device is simulator
    }
    else
    {
        //its a real watch?
    }

2016-01-25 22:32:12.540 Watch Extension[4275:131894] awakeWithContext ...
2016-01-25 22:32:12.541 Watch Extension[4275:131894] willActivate ...
2016-01-25 22:32:12.595 Watch Extension[4275:131894] modelNameStr: MacBookPro2012 ...
Sam B
  • 27,273
  • 15
  • 84
  • 121