From d65cdf62e368c8c59258616bd949b8a2d82bcf54 Mon Sep 17 00:00:00 2001 From: Daniel Toplak Date: Wed, 23 May 2018 07:07:09 +0200 Subject: [PATCH] CB-14106 - device.model is different on simulator and on real device (#80) --- src/ios/CDVDevice.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m index 4d75a574..de535332 100644 --- a/src/ios/CDVDevice.m +++ b/src/ios/CDVDevice.m @@ -28,6 +28,9 @@ @implementation UIDevice (ModelVersion) - (NSString*)modelVersion { +#if TARGET_IPHONE_SIMULATOR + NSString* platform = NSProcessInfo.processInfo.environment[@"SIMULATOR_MODEL_IDENTIFIER"]; +#else size_t size; sysctlbyname("hw.machine", NULL, &size, NULL, 0); @@ -35,7 +38,7 @@ - (NSString*)modelVersion sysctlbyname("hw.machine", machine, &size, NULL, 0); NSString* platform = [NSString stringWithUTF8String:machine]; free(machine); - +#endif return platform; }