facebook-ios-sdk icon indicating copy to clipboard operation
facebook-ios-sdk copied to clipboard

Don't show 'isAdvertiserTrackingEnabled' deprecation warning below iOS 17

Open chwo opened this issue 3 months ago • 10 comments

Checklist before submitting a bug report

Xcode version

15.3

Facebook iOS SDK version

17.0.0

Dependency Manager

CocoaPods

SDK Framework

Core

Goals

I want to use the sdk according to the documentation without getting a deprecation warning.

Expected results

According to the documentation, manually setting the isAdvertiserTrackingEnabled parameter is only necessary up to iOS 17:

For iOS 17.0 and later devices, you are no longer required to set the Advertiser Tracking Enabled parameter for Facebook SDK for iOS 17.0.0 and later versions. We now rely on Apple’s App Tracking Transparency (ATT) system API to determine ATT permission status for app events sent through Facebook SDK for iOS 17.0.0 and later versions.

So with a lower minimum deployment target (e.g. iOS 16) it is still necessary to manually set the parameter. E.g.

if #unavailable(iOS 17) {
    FBSDKCoreKit.Settings.shared.isAdvertiserTrackingEnabled = true
}

In that case there should be no deprecation warning because it is useless until one updates the minimum deployment target to iOS 17.

Actual results

After updating the sdk to version 17.0.0 and FBAudienceNetwork to version 6.15.0 this gives a deprecation warning (defined in FBAdSettings.h):

Setter for 'isAdvertiserTrackingEnabled' is deprecated: The setAdvertiserTrackingEnabled flag is not used for FBSDK v17+ on iOS 17+ as the FBSDK v17+ now relies on ATTrackingManager.trackingAuthorizationStatus.

/**
 User's consent for advertiser tracking.
 */
+ (void)setAdvertiserTrackingEnabled:(BOOL)advertiserTrackingEnabled
    NS_DEPRECATED_IOS(
        12_0,
        17_0,
        "The setter for advertiserTrackingEnabled flag is deprecated: The setAdvertiserTrackingEnabled flag is not used for Audience Network SDK 6.15.0+ on iOS 17+ as the Audience Network SDK 6.15.0+ on iOS 17+ now relies on [ATTrackingManager trackingAuthorizationStatus] to accurately represent ATT permission for users of your app");

Steps to reproduce

No response

Code samples & details

// INSERT YOUR CODE HERE
var example = "Example code"

chwo avatar Apr 04 '24 12:04 chwo

i have same issue

sea7reen avatar Apr 07 '24 08:04 sea7reen

Same

VladOrackle avatar Apr 08 '24 14:04 VladOrackle

same

Nass33m avatar Apr 09 '24 02:04 Nass33m

up

michalnowak061 avatar Apr 12 '24 19:04 michalnowak061

same

YixingWangJ avatar Apr 16 '24 12:04 YixingWangJ

Same, please fix

ezanalemma avatar Apr 20 '24 16:04 ezanalemma

Same

UnuSynth avatar Apr 23 '24 09:04 UnuSynth

Same

ionutivan avatar Apr 24 '24 12:04 ionutivan

Is this really the case that the SDK would still need this flag for iOS < 17? Or is only about the v17 of the SDK?

From the code it looks as this if really for iOS 14+, and the issue here seems the miss-leading documentation:

https://github.com/facebook/facebook-ios-sdk/blob/7295c425d8ca789a7861472d841468b24d30de9f/FBSDKCoreKit/FBSDKCoreKit/Settings.swift#L408-L423

guillermomuntaner avatar Apr 30 '24 09:04 guillermomuntaner

Is this really the case that the SDK would still need this flag for iOS < 17? Or is only about the v17 of the SDK?

From the code it looks as this if really for iOS 14+, and the issue here seems the miss-leading documentation:

https://github.com/facebook/facebook-ios-sdk/blob/7295c425d8ca789a7861472d841468b24d30de9f/FBSDKCoreKit/FBSDKCoreKit/Settings.swift#L408-L423

Seems like SDK uses _advertisingTrackingStatusFromATT only when isDomainHandlingEnabled() returns true.

https://github.com/facebook/facebook-ios-sdk/blob/7295c425d8ca789a7861472d841468b24d30de9f/FBSDKCoreKit/FBSDKCoreKit/Settings.swift#L388-L394

And isDomainHandlingEnabled always returns true for iOS >= 17, but not for iOS < 17.

https://github.com/facebook/facebook-ios-sdk/blob/7295c425d8ca789a7861472d841468b24d30de9f/FBSDKCoreKit/FBSDKCoreKit/Internal/DomainHandler/FBSDKDomainHandler.m#L136-L149

So it seems like the warning for iOS < 17 should be suppressed.

kyounh12 avatar May 04 '24 17:05 kyounh12