15

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?

M. Mansuelli
  • 1,083
  • 9
  • 19

4 Answers4

17

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
M. Mansuelli
  • 1,083
  • 9
  • 19
8

Just in case for objective-c case:

[FBSDKAppEvents.shared activateApp];
Medhi
  • 2,656
  • 23
  • 16
4

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

 AppEvents.shared.activateApp()

Static  change to Shared

m4n0
  • 29,823
  • 27
  • 76
  • 89
xzips
  • 51
  • 3
  • instead of using images that contains code use code blocks to make it easier for those who want to copy your code. – Mahdi Zarei Oct 27 '21 at 12:48
2

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.

parbo
  • 243
  • 3
  • 7