Runtime Device Check

This is slightly more complex, but I’m sure you’ve heard of identifiers such as “iPhone6,1” or “iPad 3,3” – that’s Apple’s internal numbering system for iOS devices. With this check we can get very fine grained information about the hardware capabilities a device will have.

To use it, we need to first import the sysctrl framework into our app like so:

#import <sys/sysctl.h>

Then we can use some C methods that reads out this magic identifier. Here’s how:

First we grab the string of this magic identifier, then we compare it to a LONG list of possible values and extract the model number. The list above is not complete and it’s just meant for demo purposes. You get the idea.