iosiphonexcodecpuprocessors

How can I get the internal name on iOS?


I need to get CPU information on iOS. I'm doing this through the code iPhone8,1 (this is the iPhone 6s), but iPhone 6s, 6s plus and iPhone SE has two different processors one by Samsung(N69uAP) and the other is made by TSMC (N69AP). I need to know what processor is used in the phone I'm using, does anyone knows how can I difference them in these case? The only thing I know is that those codes difference them (N69uAP and N69AP), but I don't know how to get them. This is what I do in the older iPhones that has only one processor per model:

if (([platform isEqualToString:@"iPhone7,1"]) ||([platform isEqualToString:@"iPhone7,2"]))
    return @"T7000";
//this is iPhone 6 

The site I got the information about the iPhones: https://www.theiphonewiki.com/wiki/Models#iPhone


Solution

  • Just an idea, but maybe sysctl can help. Running sysctl on my Mac returns info such as this (among many other lines):

    $ sysctl -A | grep cpu ... hw.cputype: 7 hw.cpusubtype: 8 hw.cpufamily: 280134364 hw.cpufrequency: 2600000000 machdep.cpu.vendor: GenuineIntel machdep.cpu.brand_string: Intel(R) Core(TM) i7-4960HQ CPU @ 2.60GHz machdep.cpu.family: 6 machdep.cpu.model: 70 machdep.cpu.extmodel: 4 machdep.cpu.extfamily: 0 ...

    I haven't tested if the same information is available on iOS, but I think it's worth a try. Matt Gallagher's article Gathering system information in Swift with sysctl may be helpful for info how to call sysctl. It's targeted at Swift, but it should be even easier to call sysctl in Objective-C.