2011-09-29 30 views

回答

5

你可能会检查模型ID与功能(credits):

#include <sys/types.h> 
#include <sys/sysctl.h> 
NSString* machine() { 
     size_t size; 

      // Set 'oldp' parameter to NULL to get the size of the data 
      // returned so we can allocate appropriate amount of space 
     sysctlbyname("hw.machine", NULL, &size, NULL, 0); 

      // Allocate the space to store name 
     char *name = malloc(size); 

      // Get the platform name 
     sysctlbyname("hw.machine", name, &size, NULL, 0); 

      // Place name into a string 
     NSString *machineid = [NSString stringWithUTF8String:name]; 

      // Done with this 
     free(name); 

     return machineid; 
    } 

函数将返回字符串如@ “iPhone3,3”,它代表了iPhone 4(CDMA/Verizon公司)。收集各种型号的完整表格可能很困难。一些模型描述可以在here找到。随着新模型的出现,您将不得不展开模型表格。