On the first of May, 2013, Apple began rejecting any app or app update in the App Store if it accessed UDIDs, moving app developers towards its own preferred ad tracking option, the Identifier for Advertisers (IDFA). IDFA stands for “identifier for advertisers.” It’s a random, anonymous number that is assigned to a user and their device. It is temporary and can be blocked, like a cookie.
If you need to uniquely identify a user, read below on how you can access the IDFA.
Retrieve iPhone IDFA
You first have to check if user user has decided to opt out from ad tracking. Only if he allowed it you use the IDFA.
You can check it by calling isAdvertisingTrackingEnabled method of ASIdentifierManager.
isAdvertisingTrackingEnabled
Check the value of this property before performing any advertising tracking. If the value is NO, use the advertising identifier only for the following purposes: frequency capping, conversion events, estimating the number of unique users, security and fraud detection, and debugging.
The following code snippet shows how to obtain a string value of IDFA.
- (NSString *)identifierForAdvertising { if([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) { NSUUID *IDFA = [[ASIdentifierManager sharedManager] advertisingIdentifier]; return [IDFA UUIDString]; } return nil; }
You’ll need to link with AdSupport framework. If you only target iOS 7 and above, you can add it using modules.
@import AdSupport;
How to Submit Your App When it Uses IDFA
Before you submit a new app or a new version of an existing app to Apple’s App Store, note that Apple has recently updated the IDFA settings so that you must agree to their revised terms of service by selecting a check box that indicates your compliance.
When you submit your apps with iTunes Connect, you’ll now be prompted with three checkboxes certifying your intentions to use IFA for:
- 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
To avoid app store rejections, ensure that you select the appropriate IDFA usage check-boxes for your app and honor Apple’s “Limit Ad Tracking” requirement.