user3883249
user3883249

Reputation: 127

How to get advertising identifier on IOS

I'm doing Work light Project, and i need a plugin to get advertising identifier, which value not change unless user hard reset them phone.
But because i'm never do IOS before, so i don't know how to get advertising identifier on IOS 6,7.
I was try identifierForVendor, but it change everytime i reinstall an application.
Any help for me ? (i do not need push this app to appstore).

Upvotes: 3

Views: 11643

Answers (2)

Mradul Kumar
Mradul Kumar

Reputation: 357

To get AdvertisingId of any iOS Device do this :
Only for iOS versions > 6.0

#import <AdSupport/ASIdentifierManager.h>
NSUUID *adId = [[ASIdentifierManager sharedManager] advertisingIdentifier];
NSString *str = [adId UUIDString];

Upvotes: 14

ppolak
ppolak

Reputation: 641

Did you try to use advertisingIdentifier?

If you check the documentation https://developer.apple.com/Library/ios/documentation/AdSupport/Reference/ASIdentifierManager_Ref/ASIdentifierManager.html#//apple_ref/doc/uid/TP40012654-CH1-SW4

Unlike the identifierForVendor property of the UIDevice, the same value is returned to all vendors. This identifier may change—for example, if the user erases the device—so you should not cache it. 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.

Upvotes: 1

Related Questions