检测特定的iPhone/iPodtouch型号
编辑:
#include <sys/types.h>#include <sys/sysctl.h>@implementation UIDevice (Hardware)/*
Platforms
iPhone1,1 -> iPhone 1G
iPhone1,2 -> iPhone 3G
iPod1,1 -> iPod touch 1G
iPod2,1 -> iPod touch 2G
*/- (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 stringWithCString:machine encoding:NSUTF8StringEncoding];
free(machine);
return platform;}
慕田峪4524236
慕虎7371278
随时随地看视频慕课网APP
相关分类