iOS 14 get user consent with Facebook SDK
The documentation is at least misleading. You have to import FBSDKCoreKit.FBSDKSettings
and the snippet is Settings.setAdvertiserTrackingEnabled(true)
. As you can see, it is not FBAdSettings
but only Settings
.
the right solution is to use iOS Audience Network SDK >6.0
and do:
import FBAudienceNetwork
it will work.
You have to import the FBAudienceNetwork library
In Objective-C
#include <FBAudienceNetwork/FBAdSettings.h>
In Swift
import FBAudienceNetwork
I found out that you don't even need the method Settings.setAdvertiserTrackingEnabled(true)
if you just want to log events.
So you can remove it from the authorization request, in fact the request is sufficient to activate event logging.
You can verify it by using Facebook's Event Manager to test your logged events.