facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.73k stars 3.5k forks source link

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

Open chwo opened 1 month ago

chwo commented 1 month ago

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"
sea7reen commented 1 month ago

i have same issue

VladOrackle commented 1 month ago

Same

Nass33m commented 1 month ago

same

michalnowak061 commented 1 month ago

up

YixingWangJ commented 1 month ago

same

ezanalemma commented 3 weeks ago

Same, please fix

UnuSynth commented 3 weeks ago

Same

ionutivan commented 3 weeks ago

Same

guillermomuntaner commented 2 weeks ago

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

kyounh12 commented 1 week ago

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.