iOS 判断iPhone机型的方法
+ (BOOL)isNotIphone3G { static BOOL done = FALSE; static BOOL result; if (!done) { size_t size; sysctlbyname("hw.machine", NULL, &size, NULL, 0); char *machine = malloc(size); sysctlbyname("hw.machine", machine, &size, NULL, 0); NSString *platform = [[NSString alloc] initWithUTF8String:machine]; free(machine); result = ![platform isEqualToString:@"iPhone1,2"]; done = TRUE; } return result; }
以上是以objective—C判断是否是iPhone3G的方法,具体自己替换iPhone代号名字;
转载必须注明原文链接。