是否可以判断它在应用程序中的模拟器还是真实设备上运行



我想在模拟器或在服务器上。

例如=>服务器名称

  • 在模拟器上=> localhost
  • 在Real Device => MyServer.com

目前,我的环境是钛。

但是,我想知道在Xcode上可能。

这对我来说可能是一个很好的提示,如果iMopposible onxcode,在钛中也是不可能的。

for android

Build.FINGERPRINT.startsWith("generic")

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"));

相关内容

最新更新