Skip to content

Instantly share code, notes, and snippets.

@yuchan
Last active January 3, 2016 23:19
Show Gist options
  • Save yuchan/8534509 to your computer and use it in GitHub Desktop.
Save yuchan/8534509 to your computer and use it in GitHub Desktop.
snippet for retreiving iOS machine name.
// This is pseudo code.
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *name = malloc(size);
sysctlbyname("hw.machine", name, &size, NULL, 0);
NSString *modelIdentifier = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
free(name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment