Is it possible to fetch iPhone device model number (MT552GR/A) programatically?

36 Views Asked by At

I want to fetch the iPhone device's model country region. The MT552 is an iPhone XS Max, Gold, 256GB. You can find these numbers on the Models (https://www.theiphonewiki.com/wiki/Models) page. The two letters behind it, GR in this case, specify the (Greece) region code. https://www.theiphonewiki.com/wiki/Model_Regions

Is there iOS SDK API to fetch full model number (MT552GR/A) or atleast region code (GR)? Thanks in advance

I tried as follows:

1.

#pragma mark sysctlbyname utils
- (NSString *) getSysInfoByName:(char *)typeSpecifier
{
  size_t size; sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
  char *answer = malloc(size); sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
  NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
  free(answer); return results;
}
  (NSString *) modelIdentifier { return [self getSysInfoByName:"hw.machine"]; }
(NSString *) hwmodel { return [self getSysInfoByName:"hw.model"]; }
0

There are 0 best solutions below