How to use AppEvents.activateApp() in 12.0.0 version

5.9k Views Asked by At

I have updated the FBSDKAppEvents to 12.0.0 version, and the function AppEvents.activateApp() in AppDelegate is now deprecated. I have searched in the Facebook documentation, and unfortunately I didn't found any information about that, and I don't understand what's method I want to use to replace the deprecated:

Deprecated function

The message is: "'activateApp()' is deprecated: The class method activateApp is deprecated. It is replaced by an instance method of the same name."

Did anyone know what code I have to put to replace the deprecated one?

4

There are 4 best solutions below

0
M. Mansuelli On BEST ANSWER

I have updated the FBSDKAppEvents to 12.0.0 version and now we can use this code below:

func applicationDidBecomeActive(_ application: UIApplication) {
    AppEvents.shared.activateApp()
}

And some Settings on FDSDKAppEvents changed a little, and now we need to update to Settings.shared, for example:

Settings.shared.enableLoggingBehavior(.appEvents)
Settings.shared.enableLoggingBehavior(.developerErrors)
Settings.shared.enableLoggingBehavior(.cacheErrors)
Settings.shared.enableLoggingBehavior(.uiControlErrors)
Settings.shared.isAdvertiserTrackingEnabled = isEnabled
Settings.shared.isAutoLogAppEventsEnabled = isEnabled
Settings.shared.isAdvertiserIDCollectionEnabled = isEnabled
0
parbo On

According to github issue both solutions should work until FB team replace singleton with shared

We can use static method or singleton's instance method.

1
xzips On

You need to update your code. ı fix with this code

 AppEvents.shared.activateApp()

Static  change to Shared

0
Medhi On

Just in case for objective-c case:

[FBSDKAppEvents.shared activateApp];