获取iphone手机型号
需要在头文件中引入#include <sys/types.h>
#include <sys/sysctl.h>
size_t size;
int nR = sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = (char *)malloc(size);
nR = sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];
NSLog(@"platform:%@",platform);
free(machine);
页:
[1]