Skip to content

Commit

Permalink
CB-14106 - device.model is different on simulator and on real device (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Toplak authored and shazron committed May 23, 2018
1 parent ee3cb6d commit d65cdf6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ios/CDVDevice.m
Expand Up @@ -28,14 +28,17 @@ @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);
char* machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString* platform = [NSString stringWithUTF8String:machine];
free(machine);

#endif
return platform;
}

Expand Down

0 comments on commit d65cdf6

Please sign in to comment.