This guide shows you how to enable and disable advertising tracking.
Starting with iOS 14, you will need to set
AdvertiserTrackingEnabled and log each time you give a device permission to share data with Facebook.
Use the Advertiser Tracking Enabled parameter to indicate whether we should use event data for ads in line with your own legal obligations, platform terms and commitments you’ve made to your users.
AdvertiserTrackingEnabled is only available for iOS 14+.
If a device provides consent, call the
setAdvertiserTrackingEnabled method of the
FBSDKSettings class and set it to
YES for Objective-C or
true for Swift. If a device does not allow tracking, set
NO for Objective-C or
false for Swift. The method will return a boolean value to indicate whether the method is set successfully or not.
// Set isAdvertiserTrackingEnabled to true if a device provides consent
Settings.shared.isAdvertiserTrackingEnabled = true
// Set isAdvertiserTrackingEnabled to false if a device does not provide consent
Settings.shared.isAdvertiserTrackingEnabled = false
After a user assents to advertiser tracking and you enable events, be sure to initialize the SDK before sending events.