【问题标题】:Is it possible to tell if it runs on simulator or real device in the application [duplicate]是否可以判断它是在应用程序中的模拟器还是真实设备上运行[重复]
【发布时间】:2017-07-10 02:06:47
【问题描述】:

当它在模拟器中工作时,我想更改一些参数或 在服务器上。

例如 => 服务器名称

  • 在模拟器上 => 本地主机
  • 在真实设备上 => myserver.com

目前,我的环境是钛。

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

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

【问题讨论】:

标签: android ios xcode titanium


【解决方案1】:

适用于安卓

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-27
    • 2015-12-20
    • 2011-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-27
    相关资源
    最近更新 更多