I have using the following code for get identifier
deviceName = [[UIDevice currentDevice]uniqueIdentifier];
But i got the warning uniqueIdentifier is deprecated in ios5.
so how to get the identifier value in ios5?
You can use the following code
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
// This will run if it is iOS6 or higher
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
// This will run before iOS6 and you can use openUDID or other
// method to generate an identifier
}
And this way you can maintain the previous min requirement.
This identifier is unique for all the apps from one vendor. If you want unique identifier for device you need to use:
if (!NSClassFromString(@"ASIdentifierManager")) {
// This will run before iOS6 and you can use openUDID, per example...
return [OpenUDID value];
}
return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
Warning: There is a bug on iOS6 that reports "null" identifier if the device was updated "by air" - More info