看到获取UDID,在IOS5.0已经过时了,原文说明
------------------------------------------------------------------------------------------------------------
Deprecated in iOS 5.0
uniqueIdentifier
An alphanumeric string unique to each device based on varioushardware details. (read-only) ( Deprecated in iOS 5.0. Instead,create a unique identifier specific to your app.)
@property (nonatomic, readonly, retain) NSString*uniqueIdentifier
Special Considerations
Do not use the uniqueIdentifier property. To create a uniqueidentifier specific to your app, you can call the CFUUIDCreate function to create aUUID, and write it to the defaults database using theNSUserDefaults class.
Availability
Available in iOS 2.0 and later.
Deprecated in iOS 5.0.
Related Sample Code
GKTank
Declared In
UIDevice.h
------------------------------------------------------------------------------------------------------------
经高手指点使用
也可参考
http://maniacdev.com/2011/08/open-source-unique-device-id-generator-for-udid-alternative/
上面链接的例子:
https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5
Description
Apple stopped supporting a unique identifier for iOS. This sourcecode solves the problem. It generates a unique identifier based onthe mac address of the device in combination with the bundleidentifier.
What you need to do:
copy NSString+MD5Addition and UIDevice+IdentifierAddition to yourproject.
use [[UIDevice currentDevice] uniqueDeviceIdentifier] to retrievethe unique identifier or
use [[UIDevice currentDevice] uniqueGlobalDeviceIdenti
fier] toretrieve a global unique identifier (used for tracking betweendifferent apps).
have fun and follow twitter.com/gekitz ;)
//Thanks to Erica Sadun for her UIDevice+Hardware Addition (usedfor the mac address retrieval).
拷贝 NSString+MD5Addition 和UIDevice+IdentifierAddition到你的项目,使用
[[UIDevice currentDevice]uniqueDeviceIdentifier] 或
[[UIDevice currentDevice]uniqueGlobalDeviceIdenti fier]
就可以了
------------------------------------------------------------------------------------------------------------
Deprecated in iOS 5.0
uniqueIdentifier
An alphanumeric string unique to each device based on varioushardware details. (read-only) ( Deprecated in iOS 5.0. Instead,create a unique identifier specific to your app.)
@property (nonatomic, readonly, retain) NSString*uniqueIdentifier
Special Considerations
Do not use the uniqueIdentifier property. To create a uniqueidentifier specific to your app, you can call the CFUUIDCreate function to create aUUID, and write it to the defaults database using theNSUserDefaults class.
Availability
Available in iOS 2.0 and later.
Deprecated in iOS 5.0.
Related Sample Code
GKTank
Declared In
UIDevice.h
------------------------------------------------------------------------------------------------------------
经高手指点使用
CFUUIDRef uuid = CFUUIDCreate(NULL);
CFStringRef uuidStr = CFUUIDCreateString(NULL,uuid);
NSString *strUid = [NSStringstringWithFormat:@"%@",uuidStr];
CFRelease(uuidStr);
CFRelease(uuid);
也可参考
http://maniacdev.com/2011/08/open-source-unique-device-id-generator-for-udid-alternative/
上面链接的例子:
https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5
Description
Apple stopped supporting a unique identifier for iOS. This sourcecode solves the problem. It generates a unique identifier based onthe mac address of the device in combination with the bundleidentifier.
What you need to do:
copy NSString+MD5Addition and UIDevice+IdentifierAddition to yourproject.
use [[UIDevice currentDevice] uniqueDeviceIdentifier] to retrievethe unique identifier or
use [[UIDevice currentDevice] uniqueGlobalDeviceIdenti
have fun and follow twitter.com/gekitz ;)
//Thanks to Erica Sadun for her UIDevice+Hardware Addition (usedfor the mac address retrieval).
拷贝 NSString+MD5Addition 和UIDevice+IdentifierAddition到你的项目,使用
[[UIDevice currentDevice]uniqueDeviceIdentifier]
[[UIDevice currentDevice]uniqueGlobalDeviceIdenti
就可以了