#include <sys/types.h>
#include <sys/sysctl.h>
- (NSString *) platform
{
size_t size;
sysctlbyname(“hw.machine”, NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname(“hw.machine”, machine, &size, NULL, 0);
NSString *platform =[NSString stringWithUTF8String:machine];
free(machine);
return platform;
}
获取的iphone3.1就表示是iphone4,其他的可以查查表示那个型号
转载于:https://blog.51cto.com/3507784/753229