0

I would like to change some parameters when it is works in simulator or on server.

for example => server name

  • On simulator => localhost
  • On real device => myserver.com

For now, my environment is titanium.

However I would like to know it is possible on Xcode.

It could be a good hint for me and If imopposible onxcode, it is impossible in titanium either.

whitebear
  • 11,200
  • 24
  • 114
  • 237
  • For XCode: http://stackoverflow.com/questions/5775420/programmatically-detect-if-app-is-being-run-on-device-or-simulator or for Titanium http://stackoverflow.com/questions/13090844/how-can-i-tell-if-my-titanium-app-is-running-on-the-simulator-or-not ? – Larme Feb 20 '17 at 17:19
  • Thank you this link works for me. – whitebear Feb 21 '17 at 01:12

1 Answers1

1

For Android

Build.FINGERPRINT.startsWith("generic")

For iOS

#define SIM(x) if ([[[UIDevice currentDevice].model lowercaseString] rangeOfString:@"simulator"].location != NSNotFound){x;}

SIM(NSLog(@"This will only be logged if the device is simulated"));
albeee
  • 1,452
  • 1
  • 12
  • 20