I've implemented this methods to get advertisingIdentifier
and identifierForVendor
:
- (NSString *) advertisingIdentifier
{
if (!NSClassFromString(@"ASIdentifierManager")) {
return [OpenUDID value];
}
return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
}
- (NSString *) identifierForVendor
{
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
}
return @"";
}
- (BOOL)isAdvertisingTrackingEnabled
{
if (NSClassFromString(@"ASIdentifierManager") && ![[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
return NO;
}
return YES;
}
On simulator everything is working as should be and I can get the 2 strings IDs representation.
But when I run from iPhone 3GS with iOS 6.0 (10A403), these 2 methods return "00000000-0000-0000-0000-000000000000" as identifier. Already done:
- Restarted the device
- Removed the app and reinstalled
- Created and Ad-Hoc build, installed, removed and installed again
- Run this code from another app
- Tested on iPad 2 with iOS 6.0 (10A403) and everything went ok (I've got the correct identifiers)