When I found way to get iOS device type (e.g., iPhone 6, iPhone 6 Plus), I found a way to do and it did help
but it give me this two question?
Why need the convert like this?
^ @"iPhone5,4" :@"iPhone 5c", // (model A1507, A1516, A1526 (China), A1529 | Global)
@"iPhone6,1" :@"iPhone 5s", // (model A1433, A1533 | GSM)
@"iPhone6,2" :@"iPhone 5s",
POSIX defines struct utsname
as the structure returned by the uname
function. The uname
function returns information about the current system.
The identifier systemInfo
is just a variable name. It has no special meaning.
The “need to convert” exists because utsname.machine
contains a string intended for programs, programmers and technicians, not end users. There have been multiple hardware versions of certain devices, like the iPhone 5S. Apple calls all of them “iPhone 5S” when speaking to users. Internally, you can tell which hardware version you're on by looking at the utsname.machine
string. If you want to refer to the user's device by its user-friendly name, you need to convert from the utsname.machine
string to the user-friendly name.