0

There are a number of answers to find the device name (iPhone 2,1; etc). (iOS - How to get device make and model?)

I'd like to find a way to return the device model (ME259, MD297, ME556, MF157). This would allow detecting things like iPhone 5C color.

Community
  • 1
  • 1
SAR622
  • 587
  • 1
  • 5
  • 17
  • My understanding is anything you do to access this information would be considered a breach of the developer rules and is likely to get your app rejected (if not immediately, then in a bugfix update later on). You're not allowed to know what device a user owns, for privacy reasons. Instead you should ask the user if there's anything they need to configure. – Abhi Beckert Dec 22 '13 at 14:32
  • @AbhiBeckert , while I believe that this may result in your application getting rejected, do you have any documentation to link to for further reading? It seems as though returning iPhone5,2 is telling you what device a user owns, the product/order number ( IE MD659LL/A ) would only let you know a color, which it seems you can get from a serial number possibly, and storage size, which you can get from API's that would let you get approved ( see: http://stackoverflow.com/questions/5712527/how-to-detect-total-available-free-disk-space-on-the-iphone-ipad-device ), so why block this? – conrad10781 Aug 17 '14 at 01:40

3 Answers3

3

It isn't possible, unfortunately.

As of now, the only to get the device's color is using a private API (like described in this answer).

Community
  • 1
  • 1
Tiago
  • 3,013
  • 1
  • 29
  • 45
0

You can try to get the serial numbers,I remember that some letter is to determine the phone color, but I not sure.

CodeToPlay
  • 27
  • 3
  • Spending a few minutes locating this information would have made this post useful: http://www.ifixit.com/blog/2010/07/13/is-apple-silently-fixing-the-iphone-4-antenna-issue/ is just one of the links available that explains the breakdown of the serial number, including a spot for the color, but you may find as with other suggestions that depending how you do this, your application may not get approved in the store. – conrad10781 Aug 17 '14 at 01:31
0

Include the following directive

#include <sys/sysctl.h>

Implement the following method

-(NSString*)hwModel
{
    size_t size;
    char *kHwModel = "hw.model";
    sysctlbyname(kHwModel, NULL, &size, NULL, 0);

    char *answer = malloc(size);
    sysctlbyname(kHwModel, answer, &size, NULL, 0);

    NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];

    free(answer);
    return results;
}

and in call the above method as follows:-

[self hwModel];
ldindu
  • 3,613
  • 1
  • 17
  • 22