Created
August 17, 2011 16:21
-
-
Save larsacus/1151923 to your computer and use it in GitHub Desktop.
Fetches exact model code of iOS device for logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <sys/sysctl.h> | |
- (NSString *)hardwareDeviceModelCode{ | |
size_t size; | |
sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
char *machine = malloc(size); | |
sysctlbyname("hw.machine", machine, &size, NULL, 0); | |
NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding]; | |
free(machine); | |
return platform; | |
} | |
//http://stackoverflow.com/questions/1108859/detect-the-specific-iphone-ipod-touch-model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment