1、首先要导入头文件 #import <sys/utsname.h> 2、代码如下 - (NSString *)getDeviceVersionInfo{ struct utsname systemInfo; uname(&systemInfo); NSString *platform = [NSS ...
分类:
移动开发 时间:
2017-05-16 13:10:48
阅读次数:
251
判断代码如下:- (NSString *)getMachine{ size_t size; // 隐式声明的函数sysctlbyname 在c99中是无效的 int nR;// = sysctlbyname("hw.machine", NULL, &size, NULL...
分类:
移动开发 时间:
2015-10-28 12:17:01
阅读次数:
282
三种常用的办法获取iOS设备的型号:1. [UIDevice currentDevice].model (推荐);2. uname(struct utsname *name) ,使用此函数需要#include;3.sysctlbyname(const char *name, void *oldp, ...
分类:
移动开发 时间:
2015-10-13 20:41:25
阅读次数:
202
NSString*clientModel()
{
NSString*model=[[UIDevicecurrentDevice]model];
if([modelisEqualToString:@"iPhone1,1"])return@"iPhone1G";
if([modelisEqualToString:@"iPhone1,2"])return@"iPhone3G";
if([modelisEqualToString:@"iPhone2,1"])return@"iPhone3GS";
if([modeli..
分类:
移动开发 时间:
2015-09-15 20:15:07
阅读次数:
166
+?(?NSString?*)deviceString
{
?????//?需要#import?"sys/utsname.h"
?????struct?utsname?systemInfo;
?????uname(&systemInfo);
?????NSString?*deviceString?=?[?NSString?s...
分类:
移动开发 时间:
2015-07-28 14:55:08
阅读次数:
161
//设备具体型号需要
#import
//获得设备型号
+ (NSString *)getCurrentDevice
{
int mib[2];
size_t len;
char *machine;
mib[0] = CTL_HW;
mib[1] = HW_MACHINE;
sysctl(mib, 2, NULL, &len, NULL...
分类:
移动开发 时间:
2015-03-14 11:02:36
阅读次数:
166