Now the class for Facebook(Meta) Advertising is changed from Settings class to FBAdSettings class in new updated versions of the Facebook(Meta) and also there is a new library is defined for it which FBAudienceNetwork.
So to resolve this please install FBAudienceNetwork first and then write:-
FBAdSettings.setAdvertiserTrackingEnabled(true)
If anyone is getting issues with Facebook(Meta) updated SDK code so some of the changes I am listing here, please check those:-
1). Instance member 'logEvent' cannot be used on type 'AppEvents'; did you mean to use a value of this type instead?
Solution :- Instead of using AppEvents.logEvent use AppEvents.shared.logEvent.
2). Cannot convert value of type 'String' to expected dictionary key type 'AppEvents.ParameterName'
Solution :- Instead of using AppEvents.ParameterName.registrationMethod.rawValue as a parameter key use AppEvents.ParameterName.registrationMethod. Means remove "rawValue" from the parameter keys of parameters provided by Facebook.
Along with this if you get error Cannot convert '[String : Any]' to expected argument type '[AppEvents.ParameterName : Any]', then please remove .rawValue from every key of the dictionary declared for parameters which you want to share with Facebook(Meta) SDK AppEvent.
3). Instance member 'activateApp' cannot be used on type 'AppEvents'; did you mean to use a value of this type instead?
Solution:- Just add "Shared" before "activateApp()". Like,
AppEvents.shared.activateApp()
4). Instance member 'logPurchase' cannot be used on type 'AppEvents'; did you mean to use a value of this type instead?
Solution:- There is a change in log purchase event which is AppEvents class is now singleton class in Facebook(Meta) SDK so we have to add "Shared" with every function we want to call from Facebook(Meta) SDK class so, log purchase method will be called as:-
AppEvents.shared.logPurchase(amount: amount, currency: “GBP”)
Note:- From Facebook(Meta) SDK version 13.0 it is mandatory to add client_token in info.plist with appId and AppName, because it will be required for all calls to the Graph API.
//Code for info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbAPP-ID</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>APP-ID</string>
<key>FacebookClientToken</key>
<string>CLIENT-TOKEN</string>
<key>FacebookDisplayName</key>
<string>APP-NAME</string>
I Hope this will help !