+ (NSString *)getSysInfoByName:(char *)typeSpecifier {
size_t size;
sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
char *answer = malloc(size);
sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
free(answer);
return results;
}
// to get the hardware version, we need to pass the argument hw.machine
[ClassName getSysInfoByName:"hw.machine"];
//getSysInfoByName is class method so we need to call by class name
1 comment:
great tuts
Post a Comment