获得IPhone手机的相关硬件和其版本支持的SDK信息

来源:互联网 发布:淘宝卖gv资源的店子 编辑:程序博客网 时间:2024/05/29 13:57

主要类:UIDevice


例如:如下代码获得了设备是否支持多线程

UIDevice* device = [UIDevice currentDevice];if ([device respondsToSelector:@selector(isMultitaskingSupported)]) {_multitaskingSupported = device.multitaskingSupported;}



再比如:获得设备的ID号:

iphone开发时某些情况我们可能需要获取用户使用的设备唯一编号来做一些事情。

我现在要实现一个验证的过程,但目前为止ios 最新sdk中还没有提供获取用户手机号码的api,所以只有通过获取设备id做验证了,具体代码很简单。
//获取设备id号
UIDevice *device = [UIDevice currentDevice];//创建设备对象
NSString *deviceUID = [[NSString alloc] initWithString:[device uniqueIdentifier]];
NSLog(@"%@",deviceUID); // 输出设备id

原创粉丝点击