2011-11-18 126 views
3

我已经在我的应用程序中使用了这个函数来返回我的设备的型号名称,并且工作得很好,但是我怎样才能找到这个函数的返回值的完整列表(对于iphone3,3gs ,4S,iPad的,IPAD2,iPod的ECC ECCios设备名称列表

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]; 
free(machine); 
return platform; 

感谢

+4

你可以在这里找到大部分:https://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.m – Luke

回答

6

您也可以使用通过如下类,让您的移动操作系统的所有细节:

NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]); 
NSLog(@"name: %@", [[UIDevice currentDevice] name]); 
NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]); 
NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]); 
NSLog(@"model: %@", [[UIDevice currentDevice] model]); 
NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);