Skip to content

Commit

Permalink
Added code to identify the simulators
Browse files Browse the repository at this point in the history
  • Loading branch information
InderKumarRathore committed Oct 25, 2018
1 parent 336dce2 commit fa656df
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions DeviceUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ - (NSString*)hardwareString {
sysctl(name, 2, hw_machine, &size, NULL, 0);
NSString *hardware = [NSString stringWithUTF8String:hw_machine];
free(hw_machine);

// Check if the hardware is simulator
if ([hardware isEqualToString:i386_Sim] || [hardware isEqualToString:x86_64_Sim]) {
NSString *deviceID = [[[NSProcessInfo processInfo] environment] objectForKey:@"SIMULATOR_MODEL_IDENTIFIER"];
if (deviceID != nil) {
hardware = deviceID;
}
}
return hardware;
}

Expand Down

0 comments on commit fa656df

Please sign in to comment.