EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 441 forks source link

Several "session_start" event are created on iOS 15 #1869

Closed Z28ILOPE closed 2 years ago

Z28ILOPE commented 2 years ago

When the app is in background, Analytics receives a large numbers of "session-start" events for an user. This issue is caused by the life cycle inconsistency of Swift apps on iOS 15.

This issue is in the firebase-ios-sdk repository since August... More information:

https://github.com/firebase/firebase-ios-sdk/issues/6161

My company has contacted with Google and the solution we have received is this code has to implemented:

class AppDelegate: UIResponder, UIApplicationDelegate {
  static var isFirebaseAppConfigured = false

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Don't call FirebaseApp.configure() here.
    return true
  }

  // MARK: UISceneSession Lifecycle
  func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
    // Ensure FirebaseApp.configure() gets called only once.
    if (!AppDelegate.isFirebaseAppConfigured) {
      FirebaseApp.configure()
      AppDelegate.isFirebaseAppConfigured = true
    }
    ...
  }
...
}

Does the code have to be on nativescript-plugin-firebase or can it be implemented through a hook?

My configuration:

Z28ILOPE commented 2 years ago

This issue is resolving in Firebase Apple SDK. Is it possible to update to the version 8.12.1?

https://firebase.google.com/support/release-notes/ios

Captura de pantalla 2022-02-21 a las 9 45 44