[UIDevice uniqueIdentifier] 文檔中指明的替代方法之一(一共有三個替代方法):
uniqueIdentifier property Available in iOS 2.0 through iOS 6.1
uniqueIdentifier 屬性可用於 iOS 2.0 至 iOS 6.1
uniqueIdentifier
An alphanumeric string unique to each device based on various hardware details. (read-only) (Available in iOS 2.0 through iOS 6.1.
一個基於多種硬件信息的對每一個設備都唯一的數字字母組合串。(只讀)(可用於 iOS 2.0 至 iOS 6.1)
替代方法:
Use the identifierForVend or property of this class
使用該類的 identifierForVendor 屬性
or the advertisingIdentifier property of the
ASIdentifierManager class instead, as appropriate,
或按需替換為 ASIdentifierManager 類的 advertisingIdentifier 屬性
or use the UUID method of the NSUUID class to create a UUID and write it to the user defaults database.)
或使用 NSUUID 類的 UUID 方法來創建一個 UUID ,並將它寫入用戶默認數據庫即 UserDefault 中。- (NSString *)generateUuidString { CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); NSString *uuidString = (NSString*)CFUUIDCreateString(kCFAllocatorDefault, uuid); [uuidString autorelease]; CFRelease(uuid); return uuidString; }