3

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?

  1. What is utsname and systemInfo, why we can get the device type through it?
  2. 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",  
    
Community
  • 1
  • 1
Wythe
  • 149
  • 3
  • 12
  • Why is it nessesary to know the iOs device type? – Jens Jan 28 '15 at 06:22
  • the manager think it will be nice to statics the user's phone type,then check if there is a relation between user's phone type and how long they use our software – Wythe Jan 28 '15 at 07:46

1 Answers1

3
  1. 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.

  2. 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.

Community
  • 1
  • 1
rob mayoff
  • 375,296
  • 67
  • 796
  • 848