iOS设备信息
iOS查看是iPhone几:iOS - How to get device make and model?
#import <sys/utsname.h> // import it in your header or implementation file. + (NSString*) deviceName { struct utsname systemInfo; uname(&systemInfo); return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; }
查看是iPhone还是iPad
NSString *device = [UIDevice currentDevice].model;
查看系统版本
[UIDevice currentDevice].systemVersion
iOS在7以后不能查看IMEI信息,提供了一个唯一标识
[device.identifierForVendor UUIDString]
查看网络状态
iOS7之后可以更精确判断网络状态
CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; NSString *radio = netinfo.currentRadioAccessTechnology; if ([radio isEqualToString:CTRadioAccessTechnologyGPRS]) { networkType = @"2G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyEdge]) { networkType = @"2G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyWCDMA]) { networkType = @"3G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyHSDPA]) { networkType = @"3G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyHSUPA]) { networkType = @"3G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyCDMA1x]) { networkType = @"2G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0]) { networkType = @"3G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA]) { networkType = @"3G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB]) { networkType = @"3G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyeHRPD]) { networkType = @"3G"; } else if ([radio isEqualToString:CTRadioAccessTechnologyLTE]) { networkType = @"4G"; }