Created
October 7, 2015 15:46
-
-
Save cburrows/b9f6f5ff0f8c71597be7 to your computer and use it in GitHub Desktop.
Detect CPU model on an iPhone
This file contains 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
// Replace ViewController.m with this in a new "Single View Application" | |
#include <sys/sysctl.h> | |
#import "ViewController.h" | |
@implementation ViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
size_t size; | |
sysctlbyname("hw.model", NULL, &size, NULL, 0); | |
char *value = malloc(size); | |
sysctlbyname("hw.model", value, &size, NULL, 0); | |
NSLog(@"%s", value); | |
free(value); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment