获取iphone的设备信息

本文介绍了UIDevice类的各种属性,包括设备唯一标识符(uniqueIdentifier)、设备名称(name)、操作系统名称(systemName)及其版本(systemVersion)、设备型号(model)及本地化型号(localizedModel)等。通过示例展示了如何获取这些属性。
Available Properties in UIDevice
  • uniqueIdentifier – identifier guaranteed to be unique for every device
  • name – arbitrary name found in General > About setting on device
  • systemName – name of the OS running on the device
  • systemVersion – current version of the OS
  • model- model, such as ”iPhone” or ”iPod touch”
  • localizedModel – same as above using a localized string

 

 

@property(nonatomic,readonly,retain) NSString *name; // e.g. "My iPhone"

@property(nonatomic,readonly,retain) NSString *model; // e.g. @"iPhone", @"iPod Touch"

@property(nonatomic,readonly,retain) NSString *localizedModel; // localized version of model

@property(nonatomic,readonly,retain) NSString *systemName; // e.g. @"iPhone OS"

@property(nonatomic,readonly,retain) NSString *systemVersion; // e.g. @"2.0"

@property(nonatomic,readonly) UIDeviceOrientation orientation; // return current device orientation

@property(nonatomic,readonly,retain) NSString *uniqueIdentifier; 

 

 

NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]);

NSLog(@"name: %@", [[UIDevice currentDevice] name]);

NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]);

NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]);

NSLog(@"model: %@", [[UIDevice currentDevice] model]);

NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);

  

--------------------------------------------------------------------------------------------------------------------------------------------------------------

iphone simulator:

2010-10-15 09:20:43.661 SmartRoadShow[1404:207] uniqueIdentifier: 759A9CA7-F880-5BB3-B225-9CE89ABF1B0D

2010-10-15 09:20:43.662 SmartRoadShow[1404:207] name: iPhone Simulator

2010-10-15 09:20:43.662 SmartRoadShow[1404:207] systemName: iPhone OS

2010-10-15 09:20:43.663 SmartRoadShow[1404:207] systemVersion: 4.0.2

2010-10-15 09:20:43.663 SmartRoadShow[1404:207] model: iPhone Simulator

2010-10-15 09:20:43.664 SmartRoadShow[1404:207] localizedModel: iPhone Simulator

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------

ipod touch:

2010-10-15 09:20:02.367 SmartRoadShow[8180:207] uniqueIdentifier: c0f52b74f9609b70e9289e95476e165df2365677

2010-10-15 09:20:02.383 SmartRoadShow[8180:207] name: iBokanWisdom iPod

2010-10-15 09:20:02.397 SmartRoadShow[8180:207] systemName: iPhone OS

2010-10-15 09:20:02.412 SmartRoadShow[8180:207] systemVersion: 3.1.2

2010-10-15 09:20:02.427 SmartRoadShow[8180:207] model: iPod touch

2010-10-15 09:20:02.442 SmartRoadShow[8180:207] localizedModel: iPod touch

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值