iphone的系统信息使用[UIDevice currentDevice]
2015-07-23 18:49
751 查看
转:http://blog.163.com/china_uv/blog/static/11713726720118141618475/
获取iphone的系统信息使用[UIDevice currentDevice],信息如下:
[[UIDevice currentDevice] systemName]:系统名称,如iPhone OS
[[UIDevice currentDevice] systemVersion]:系统版本,如4.2.1
[[UIDevice currentDevice] model]:The model of the device,如iPhone或者iPod touch
[[UIDevice currentDevice] uniqueIdentifier]:设备的惟一标识号,deviceID
[[UIDevice currentDevice] name]:设备的名称,如 张三的iPhone
[[UIDevice currentDevice] localizedModel]:The model of the device as a localized string,类似model
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html
[[UIDevice currentDevice] identifierForVendor] ]
An alphanumeric string that uniquely identifies a device to the app’s vendor. (read-only)
Objective-C
of vendor.
Normally, the vendor is determined by data provided by the App Store. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app’s bundle ID.
The bundle ID is assumed to be in reverse-DNS format.
On iOS 6, the first two components of the bundle ID are used to generate the vendor ID. if the bundle ID only has a single component, then the entire bundle ID is used.
On IOS 7, all components of the bundle except for the last component are used to generate the vendor ID. If the bundle ID only has a single component, then the entire bundle ID is used.
Table 1 shows a collection of bundle IDs and which portions of the bundle ID the system uses to calculate the vendor ID.
Table 1Example bundle identifiers
For example,
If the value is
The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one
or more of them. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution. Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where
the identifier changes.
Note
When implementing a system for serving advertisements, use the value in the
property of the
see ASIdentifierManager Class
Reference.
Swift
获取iphone的系统信息使用[UIDevice currentDevice],信息如下:
[[UIDevice currentDevice] systemName]:系统名称,如iPhone OS
[[UIDevice currentDevice] systemVersion]:系统版本,如4.2.1
[[UIDevice currentDevice] model]:The model of the device,如iPhone或者iPod touch
[[UIDevice currentDevice] uniqueIdentifier]:设备的惟一标识号,deviceID
[[UIDevice currentDevice] name]:设备的名称,如 张三的iPhone
[[UIDevice currentDevice] localizedModel]:The model of the device as a localized string,类似model
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html
[[UIDevice currentDevice] identifierForVendor] ]
An alphanumeric string that uniquely identifies a device to the app’s vendor. (read-only)
Declaration
Swiftvar identifierForVendor: NSUUID! { get }
Objective-C
@property(nonatomic, readonly, retain) NSUUID *identifierForVendor
Discussion
The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardlessof vendor.
Normally, the vendor is determined by data provided by the App Store. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app’s bundle ID.
The bundle ID is assumed to be in reverse-DNS format.
On iOS 6, the first two components of the bundle ID are used to generate the vendor ID. if the bundle ID only has a single component, then the entire bundle ID is used.
On IOS 7, all components of the bundle except for the last component are used to generate the vendor ID. If the bundle ID only has a single component, then the entire bundle ID is used.
Table 1 shows a collection of bundle IDs and which portions of the bundle ID the system uses to calculate the vendor ID.
Bundle ID | iOS 6.x | iOS 7.x |
---|---|---|
com.example.app1 | com.example.app1 | com.example.app1 |
com.example.app2 | com.example.app2 | com.example.app2 |
com.example.app.app1 | com.example.app.app1 | com.example.app.app1 |
com.example.app.app2 | com.example.app.app2 | com.example.app.app2 |
example | example | example |
com.example.app1and
com.example.app2would appear to have the same vendor ID.
If the value is
nil, wait and get the value again later. This happens, for example, after the device has been restarted but before the user has unlocked the device.
The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one
or more of them. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution. Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where
the identifier changes.
Note
When implementing a system for serving advertisements, use the value in the
advertisingIdentifier
property of the
ASIdentifierManagerclass instead of this property. Use of that property requires you to follow the guidelines set forth in the class discussion for the proper use of that identifier. For more information,
see ASIdentifierManager Class
Reference.
Import Statement
Objective-C@import UIKit;
Swift
import UIKit
Availability
Available in iOS 6.0 and later.相关文章推荐
- 建议SQLite操作使用rawQuery方法
- OC类 之 NSData NSDate NSSet NSNumber NSValue
- 多校2 1002 Buildings
- NSNumber,NSValue
- F - True Liars - poj1417(背包+并查集)
- 2015多校联合训练赛hdu 5301 Buildings 2015 Multi-University Training Contest 2 简单题
- OPEN(SAP) UI5 学习入门系列之一:扫盲与热身(上)
- Masonry与UITableView+FDTemplateLayoutCell搭配使用
- iOS总结控件三(UIView)
- MongoVUE Group分组统计查询
- requireJS
- requireJS
- mongo vue的常用操作
- BUILD_BUG_ON
- 设置UIlabel的行高
- ocp 047-40 User OE, the owner of the ORDERS table, issues the following command:
- ifconfig: ioctl 0x8914 failed: Cannot assign requested address
- xcodebuild 生成ipa包
- android关于AlertDialog.Builder中setMessage不能换行问题的解决方法
- 获得UIView对应 的viewController