What is IDFA?

Let’s decipher the acronym first. IDFA stands for Identifier for Advertising. Apple documentation says that IDFA is an identifier that can be used only for serving advertisements. An alphanumeric string unique to each device, used only for serving advertisements.

It is similar to UIDevice’s property identifierForVendor but (and that’s a very big but) its value is the same for all vendors. In short words, it uniquely identifies the iDevice. However it is not the same as an old UDID which usage has been prohibited. IDFA can change in special cases. For example when user erases the device.

When to use IDFA?

You should only use IDFA for advertising related purposes. It should not be used solely for uniquely identifying the device. Not obeying this rule might result in rejection of your app from the App Store. Basically, if your app shows advertisements, uses iAd, or responds to advertisements in any way, for example by submitting an event to your server to indicate that it was launched because user tapped on an iAd, you are good to go.

You can use IDFA for:

  • frequency capping,
  • conversion events,
  • estimating the number of unique users,
  • security and fraud detection,
  • debugging
  • iTunes Connect

Recent change in iTunes Connect added a new question the developer has to answer before marking the version as ready for upload.

Does this app use the Advertising Identifier?

Answering YES results in showing three checkboxes where you can indicate why exactly your app needs to access the Advertising Identifier.

  • Serve advertisements within the app.
  • Attribute this app installation to a previously served advertisement.
  • Attribute an action taken within this app to a previously served advertisement.

First option is self explanatory. Check this if you are showing advertisements in your app. Next two options cover various cases when your app is opened because of user interaction with an ad. A good example is sending the identifier to your advertising system to know about conversion.

How to use IDFA?

Getting IDFA is simple as I described in this SO answer. ASIdentifierManager class provides methods for getting it and checking whether user has decided to opt out from ad tracking. In this case, returned IDFA string is nil. The following code snippet shows how to obtain a string value of IDFA.

  • Objective-C
@import AdSupport;

- (NSString *)identifierForAdvertising {
    // Check whether advertising tracking is enabled
    if([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
        NSUUID *identifier = [[ASIdentifierManager sharedManager] advertisingIdentifier];
        return [identifier UUIDString];

    // Get and return IDFA
    return nil;
  • Swift
import AdSupport

func identifierForAdvertising() -> String? {
    // Check whether advertising tracking is enabled
    guard ASIdentifierManager.shared().isAdvertisingTrackingEnabled else {
        return nil

    // Get and return IDFA
    return ASIdentifierManager.shared().advertisingIdentifier.uuidString


Apple takes security very seriously. New policies for collecting used specific information regarding advertising blend very well in it. User have now a choice to opt out from behavioral advertising. It is a move in the right direction.