Giter Site home page Giter Site logo

model-identifiers's Introduction

model-identifiers

Apple model identifiers. Gives you an approximation of the device based on the model identifier.

Each entry provides the following information (if available):

  • Device - the device name (eg. MacBook Pro, iPad 2, iPad Air)
  • Generation - device generation (eg. Late 2006)
  • Variant - variants within the same generation (eg. 17-inch, Retina)

About

Created by Joris Kluivers (@kluivers on Twitter).

When using this file consider:

  • Bitcoin: 1AKhoHUVfcQ3E5PApytySgDwPgL3PpbyoF
  • Litecoin: LZyxW1Czfrrf7hfst6qztMgpWDxpeXDAjp

Find the identifier

To find your Mac model identifier, on the command line try:

$ sysctl -n hw.model

or in code:

#include <sys/types.h>
#include <sys/sysctl.h>

#if TARGET_OS_IPHONE
	char *propertyName = "hw.machine";
#else
	char *propertyName = "hw.model";
#endif

size_t size;

// Mac: use 'hw.model'. On iOS use 'hw.machine'
sysctlbyname(propertyName, NULL, &size, NULL, 0);

char *model = malloc(size);
sysctlbyname(propertyName, model, &size, NULL, 0);

// model identifier as NSString
NSString *modelIdentifier = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];

free(model);

Identifier Uniqueness

Be aware that a single identifier may refer to multiple models from different years or with different characteristics. In this case the Generation and/or the Variant could not be determined exactly and the key may be missing.

Somewhere around 2010 this practice was changed and from that point on most models have their own unique identifier.

Sources

Related Apple support pages:

model-identifiers's People

Contributors

kluivers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

model-identifiers's Issues

Add extra key for ambiguous model identifiers

Be aware that a single identifier may refer to multiple models from different years or with different characteristics. In this case the Generation and/or the Variant could not be determined exactly and the key may be missing.

In these cases, a key 'Variants' could be used, which has an array value, with multiple dictionaries with the 'Generation' + 'Variant' keys.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.