firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.47k stars 1.43k forks source link

Getting sessionID errors with Firebase uninitialized #10347

Closed miquelalvarado closed 1 year ago

miquelalvarado commented 1 year ago

Description

Description

With the release of Firebase SDK 9.6.0, we should be able to get Firebase sessionID but I'm receiving an error with the description "Analytics uninitialized". (Worth to mention that I am not integrating FirebaseAnalytics now but I've been using for years and it always worked properly).

What did I expect

To receive an actual sessionId instead of an error.

Reproducing the issue

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {

    ...

    if let filePath = plistPath,
       let options = FirebaseOptions(contentsOfFile: filePath) {
            FirebaseApp.configure(options: options)
        } else {
            FirebaseApp.configure()
        }
        Analytics.sessionID { [weak self] sessionId, error in
              // error domain: com.google.gmp.measurement.ErrorDomain
              // error code: 13
              // error description: "Analytics uninitialized"
        }
    }
    return true
}

Firebase SDK Version

9.6.0

Xcode Version

13.4.1

Installation Method

CocoaPods

Firebase Product(s)

Analytics

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

No response

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```yml PODS: - _NIODataStructures (2.40.0) - Additions (0.2.0) - Adevinta-Segment-Appboy (4.2.0): - Adevinta-Segment-Appboy/Full-SDK (= 4.2.0) - Analytics - Adevinta-Segment-Appboy/Full-SDK (4.2.0): - Analytics - Appboy-iOS-SDK (~> 4.3.0) - AdevintaAnalytics/Braze (4.9): - Adevinta-Segment-Appboy (~> 4.2.0) - AdevintaAnalytics/Core - AdevintaAnalytics/ComScore (4.9): - AdevintaAnalytics/Core - ComScore (= 6.8.1) - AdevintaAnalytics/Core (4.9): - Analytics (= 4.1.6) - analytics-ios-mcvid (= 1.2.5) - Didomi-XCFramework (= 1.68.0) - AdevintaAnalytics/GoogleAnalytics (4.9): - AdevintaAnalytics/Core - Firebase/Analytics - Firebase/Performance - FirebaseAnalytics (~> 9.6) - AdevintaAnalytics/MCVID (4.9): - AdevintaAnalytics/Core - analytics-ios-mcvid (= 1.2.5) - AdevintaAnalytics/Optimizely (4.9): - AdevintaAnalytics/Core - OptimizelySwiftSDK (~> 3.8.1) - AdevintaAnalytics/Xandr (4.9): - AdevintaAnalytics/Core - AppNexusSDK/GoogleAdapter - AdevintaLog (0.3.0) - AdPlacementManager (0.6.2): - AdPlacementManager/Core (= 0.6.2) - AdPlacementManager/Core (0.6.2): - AppNexusSDK/GoogleAdapter (~> 7.22) - Analytics (4.1.6) - analytics-ios-mcvid (1.2.5): - Analytics - AppAuth (1.6.0): - AppAuth/Core (= 1.6.0) - AppAuth/ExternalUserAgent (= 1.6.0) - AppAuth/Core (1.6.0) - AppAuth/ExternalUserAgent (1.6.0): - AppAuth/Core - Appboy-iOS-SDK (4.3.4): - Appboy-iOS-SDK/UI (= 4.3.4) - Appboy-iOS-SDK/ContentCards (4.3.4): - Appboy-iOS-SDK/Core - SDWebImage (< 6, >= 5.8.2) - Appboy-iOS-SDK/Core (4.3.4) - Appboy-iOS-SDK/InAppMessage (4.3.4): - Appboy-iOS-SDK/Core - SDWebImage (< 6, >= 5.8.2) - Appboy-iOS-SDK/NewsFeed (4.3.4): - Appboy-iOS-SDK/Core - SDWebImage (< 6, >= 5.8.2) - Appboy-iOS-SDK/UI (4.3.4): - Appboy-iOS-SDK/ContentCards - Appboy-iOS-SDK/Core - Appboy-iOS-SDK/InAppMessage - Appboy-iOS-SDK/NewsFeed - AppNexusSDK/AppNexusSDK (7.22.0) - AppNexusSDK/GoogleAdapter (7.22.0): - AppNexusSDK/AppNexusSDK (= 7.22.0) - Google-Mobile-Ads-SDK (= 9.4.0) - AppsFlyerFramework (6.8.1): - AppsFlyerFramework/Main (= 6.8.1) - AppsFlyerFramework/Main (6.8.1) - AXStateButton (1.1.4) - CNIOAtomics (2.40.0) - CNIODarwin (2.40.0) - CNIOHTTPParser (2.40.0) - CNIOLinux (2.40.0) - CNIOWindows (2.40.0) - CocoaAsyncSocket (7.6.5) - CollectionViewKit (1.2.1) - ComScore (6.8.1): - ComScore/Dynamic (= 6.8.1) - ComScore/Dynamic (6.8.1) - CropViewController (2.6.1) - DBDebugToolkit (0.5.2) - Didomi-XCFramework (1.68.0) - EasyTipView (2.0.4) - Firebase/Analytics (9.6.0): - Firebase/Core - Firebase/Core (9.6.0): - Firebase/CoreOnly - FirebaseAnalytics (~> 9.6.0) - Firebase/CoreOnly (9.6.0): - FirebaseCore (= 9.6.0) - Firebase/Crashlytics (9.6.0): - Firebase/CoreOnly - FirebaseCrashlytics (~> 9.6.0) - Firebase/Performance (9.6.0): - Firebase/CoreOnly - FirebasePerformance (~> 9.6.0) - FirebaseABTesting (9.6.0): - FirebaseCore (~> 9.0) - FirebaseAnalytics (9.6.0): - FirebaseAnalytics/AdIdSupport (= 9.6.0) - FirebaseCore (~> 9.0) - FirebaseInstallations (~> 9.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - nanopb (< 2.30910.0, >= 2.30908.0) - FirebaseAnalytics/AdIdSupport (9.6.0): - FirebaseCore (~> 9.0) - FirebaseInstallations (~> 9.0) - GoogleAppMeasurement (= 9.6.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - nanopb (< 2.30910.0, >= 2.30908.0) - FirebaseCore (9.6.0): - FirebaseCoreDiagnostics (~> 9.0) - FirebaseCoreInternal (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - FirebaseCoreDiagnostics (9.6.0): - GoogleDataTransport (< 10.0.0, >= 9.1.4) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - FirebaseCoreInternal (9.6.0): - "GoogleUtilities/NSData+zlib (~> 7.7)" - FirebaseCrashlytics (9.6.0): - FirebaseCore (~> 9.0) - FirebaseInstallations (~> 9.0) - GoogleDataTransport (< 10.0.0, >= 9.1.4) - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (~> 2.1) - FirebaseInstallations (9.6.0): - FirebaseCore (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/UserDefaults (~> 7.7) - PromisesObjC (~> 2.1) - FirebasePerformance (9.6.0): - FirebaseCore (~> 9.0) - FirebaseInstallations (~> 9.0) - FirebaseRemoteConfig (~> 9.0) - GoogleDataTransport (< 10.0.0, >= 9.1.4) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/ISASwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - FirebaseRemoteConfig (9.6.0): - FirebaseABTesting (~> 9.0) - FirebaseCore (~> 9.0) - FirebaseInstallations (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - FLAnimatedImage (1.0.17) - FormBuilder/Core (18.1.5): - CropViewController (~> 2.0) - HighlanderFoundationKit/Core (~> 8.1) - NMRangeSlider (~> 1.2) - SMImagePicker (~> 6.0) - SwiftyJSON (~> 5.0) - FormBuilder/MapPicker (18.1.5): - CropViewController (~> 2.0) - FormBuilder/Core - HighlanderFoundationKit/Core (~> 8.1) - NMRangeSlider (~> 1.2) - SMImagePicker (~> 6.0) - SwiftyJSON (~> 5.0) - VBMapPicker (~> 6.1.1) - Google-Mobile-Ads-SDK (9.4.0): - GoogleAppMeasurement (< 10.0, >= 7.0) - GoogleUserMessagingPlatform (>= 1.1) - GoogleAppMeasurement (9.6.0): - GoogleAppMeasurement/AdIdSupport (= 9.6.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleAppMeasurement/AdIdSupport (9.6.0): - GoogleAppMeasurement/WithoutAdIdSupport (= 9.6.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleAppMeasurement/WithoutAdIdSupport (9.6.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.7) - GoogleUtilities/MethodSwizzler (~> 7.7) - GoogleUtilities/Network (~> 7.7) - "GoogleUtilities/NSData+zlib (~> 7.7)" - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleDataTransport (9.2.0): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - GoogleSignIn (6.2.4): - AppAuth (~> 1.5) - GTMAppAuth (~> 1.3) - GTMSessionFetcher/Core (< 3.0, >= 1.1) - GoogleUserMessagingPlatform (2.0.1) - GoogleUtilities/AppDelegateSwizzler (7.8.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - GoogleUtilities/Environment (7.8.0): - PromisesObjC (< 3.0, >= 1.2) - GoogleUtilities/ISASwizzler (7.8.0) - GoogleUtilities/Logger (7.8.0): - GoogleUtilities/Environment - GoogleUtilities/MethodSwizzler (7.8.0): - GoogleUtilities/Logger - GoogleUtilities/Network (7.8.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - "GoogleUtilities/NSData+zlib (7.8.0)" - GoogleUtilities/Reachability (7.8.0): - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (7.8.0): - GoogleUtilities/Logger - GRMustache.swift (4.0.1) - GTMAppAuth (1.3.1): - AppAuth/Core (~> 1.6) - GTMSessionFetcher/Core (< 3.0, >= 1.5) - GTMSessionFetcher/Core (2.1.0) - HighlanderFoundationKit/Core (8.3.1) - HighlanderFoundationKit/Promises (8.3.1): - HighlanderFoundationKit/Core - PromiseKit/CorePromise (~> 6.0) - HighlanderTestKit (7.0.0): - KIF (~> 3.7) - Nocilla (~> 0.11) - OHHTTPStubs (~> 9.1.0) - KeychainAccess (3.2.1) - KIF (3.8.7): - KIF/Core (= 3.8.7) - KIF/Core (3.8.7) - KIF/IdentifierTests (3.8.7): - KIF/Core - KissXML (5.3.1): - KissXML/All (= 5.3.1) - KissXML/Additions (5.3.1): - KissXML/Core - KissXML/All (5.3.1): - KissXML/Additions - KissXML/Core - KissXML/Core (5.3.1) - libidn (1.35) - MaterialComponents/AnimationTiming (124.2.0) - MaterialComponents/Availability (124.2.0) - MaterialComponents/Buttons (124.2.0): - MaterialComponents/Elevation - MaterialComponents/Ink - MaterialComponents/private/Math - MaterialComponents/Ripple - MaterialComponents/Shadow - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/ShapeLibrary - MaterialComponents/Shapes - MaterialComponents/Typography - MDFInternationalization - MDFTextAccessibility - MaterialComponents/Elevation (124.2.0): - MaterialComponents/Availability - MaterialComponents/private/Color - MaterialComponents/private/Math - MaterialComponents/Ink (124.2.0): - MaterialComponents/Availability - MaterialComponents/private/Color - MaterialComponents/private/Math - MaterialComponents/Palettes (124.2.0) - MaterialComponents/private/Application (124.2.0) - MaterialComponents/private/Color (124.2.0): - MaterialComponents/Availability - MaterialComponents/private/Math (124.2.0) - MaterialComponents/Ripple (124.2.0): - MaterialComponents/AnimationTiming - MaterialComponents/Availability - MaterialComponents/private/Color - MaterialComponents/private/Math - MaterialComponents/Shadow (124.2.0): - MaterialComponents/Availability - MaterialComponents/ShadowElevations (124.2.0) - MaterialComponents/ShadowLayer (124.2.0): - MaterialComponents/ShadowElevations - MaterialComponents/ShapeLibrary (124.2.0): - MaterialComponents/private/Math - MaterialComponents/Shapes - MaterialComponents/Shapes (124.2.0): - MaterialComponents/private/Color - MaterialComponents/private/Math - MaterialComponents/ShadowLayer - MaterialComponents/TextFields (124.2.0): - MaterialComponents/AnimationTiming - MaterialComponents/Buttons - MaterialComponents/Elevation - MaterialComponents/Palettes - MaterialComponents/private/Math - MaterialComponents/Typography - MDFInternationalization - MaterialComponents/Typography (124.2.0): - MaterialComponents/private/Application - MaterialComponents/private/Math - MDFTextAccessibility - MDFInternationalization (3.0.0) - MDFTextAccessibility (2.0.1) - MessagingUIViews/Core (20.17.0): - HighlanderFoundationKit/Core (~> 8.0) - XMPPFramework-Adevinta/Swift (~> 4.0) - nanopb (2.30909.0): - nanopb/decode (= 2.30909.0) - nanopb/encode (= 2.30909.0) - nanopb/decode (2.30909.0) - nanopb/encode (2.30909.0) - Nimble (9.2.1) - NMRangeSlider (1.2.1) - Nocilla (0.12.0) - OHHTTPStubs (9.1.0): - OHHTTPStubs/Default (= 9.1.0) - OHHTTPStubs/Core (9.1.0) - OHHTTPStubs/Default (9.1.0): - OHHTTPStubs/Core - OHHTTPStubs/JSON - OHHTTPStubs/NSURLSession - OHHTTPStubs/OHPathHelpers - OHHTTPStubs/JSON (9.1.0): - OHHTTPStubs/Core - OHHTTPStubs/NSURLSession (9.1.0): - OHHTTPStubs/Core - OHHTTPStubs/OHPathHelpers (9.1.0) - OHHTTPStubs/Swift (9.1.0): - OHHTTPStubs/Default - OptimizelySwiftSDK (3.8.1) - PromiseKit/CorePromise (6.18.1) - PromisesObjC (2.1.1) - SchibstedGigya (0.9.0) - SchibstedSourcery (0.4.0): - Sourcery (~> 0.14) - SDWebImage (5.13.4): - SDWebImage/Core (= 5.13.4) - SDWebImage/Core (5.13.4) - SDWebImageSwiftUI (2.0.1): - SDWebImage (~> 5.10) - Shock (6.2.0): - GRMustache.swift (~> 4.0.1) - SwiftNIOHTTP1 (~> 2.40.0) - SMImagePicker (6.0.5) - SnapshotTesting (1.9.0) - Sourcery (0.18.0) - SpearCore (1.4.0): - AdevintaLog - SpearUI (1.4.0): - DBDebugToolkit (~> 0.5) - SpearCore - SVProgressHUD (2.2.5) - SwiftGen (6.6.2) - SwiftInfo (2.6.0) - SwiftLint (0.49.1) - SwiftNIO (2.40.0): - _NIODataStructures (= 2.40.0) - CNIOAtomics (= 2.40.0) - CNIODarwin (= 2.40.0) - CNIOLinux (= 2.40.0) - CNIOWindows (= 2.40.0) - SwiftNIOConcurrencyHelpers (= 2.40.0) - SwiftNIOCore (= 2.40.0) - SwiftNIOEmbedded (= 2.40.0) - SwiftNIOPosix (= 2.40.0) - SwiftNIOConcurrencyHelpers (2.40.0): - CNIOAtomics (= 2.40.0) - SwiftNIOCore (2.40.0): - CNIOAtomics (= 2.40.0) - CNIOLinux (= 2.40.0) - SwiftNIOConcurrencyHelpers (= 2.40.0) - SwiftNIOEmbedded (2.40.0): - _NIODataStructures (= 2.40.0) - CNIOAtomics (= 2.40.0) - CNIOLinux (= 2.40.0) - SwiftNIOConcurrencyHelpers (= 2.40.0) - SwiftNIOCore (= 2.40.0) - SwiftNIOHTTP1 (2.40.0): - _NIODataStructures (= 2.40.0) - CNIOAtomics (= 2.40.0) - CNIODarwin (= 2.40.0) - CNIOHTTPParser (= 2.40.0) - CNIOLinux (= 2.40.0) - CNIOWindows (= 2.40.0) - SwiftNIO (= 2.40.0) - SwiftNIOConcurrencyHelpers (= 2.40.0) - SwiftNIOCore (= 2.40.0) - SwiftNIOEmbedded (= 2.40.0) - SwiftNIOPosix (= 2.40.0) - SwiftNIOPosix (2.40.0): - _NIODataStructures (= 2.40.0) - CNIOAtomics (= 2.40.0) - CNIODarwin (= 2.40.0) - CNIOLinux (= 2.40.0) - CNIOWindows (= 2.40.0) - SwiftNIOConcurrencyHelpers (= 2.40.0) - SwiftNIOCore (= 2.40.0) - SwiftUIPager (2.3.2) - SwiftyJSON (5.0.1) - VBMapPicker (6.1.1) - XLPagerTabStrip (9.0.0) - XMPPFramework-Adevinta/default (4.0.0): - CocoaAsyncSocket (~> 7.6) - KissXML (~> 5.2) - libidn (~> 1.35) - XMPPFramework-Adevinta/Swift (4.0.0): - XMPPFramework-Adevinta/default DEPENDENCIES: - "Additions (from `git@github.mpi-internal.com:scmspain/ios-common--lib-additions.git`, tag `0.2.0`)" - AdevintaAnalytics/Braze (from `../ios-common--lib-analytics`) - AdevintaAnalytics/ComScore (from `../ios-common--lib-analytics`) - AdevintaAnalytics/GoogleAnalytics (from `../ios-common--lib-analytics`) - AdevintaAnalytics/MCVID (from `../ios-common--lib-analytics`) - AdevintaAnalytics/Optimizely (from `../ios-common--lib-analytics`) - AdevintaAnalytics/Xandr (from `../ios-common--lib-analytics`) - "AdPlacementManager (from `git@github.mpi-internal.com:scmspain/ios-common--lib-ad-placement-manager.git`, tag `0.6.2`)" - Analytics (= 4.1.6) - analytics-ios-mcvid (= 1.2.5) - AppsFlyerFramework - AXStateButton - CollectionViewKit (~> 1.0) - DBDebugToolkit (~> 0.5.2) - EasyTipView (~> 2.0.4) - Firebase/Analytics (~> 9.6) - Firebase/Crashlytics (~> 9.6) - Firebase/Performance (~> 9.6) - FLAnimatedImage - FormBuilder/Core (~> 18.1.5) - FormBuilder/MapPicker (~> 18.1.5) - GoogleSignIn - HighlanderFoundationKit/Promises (~> 8.3.1) - HighlanderTestKit (~> 7.0) - KeychainAccess (~> 3.0) - KIF/IdentifierTests - MaterialComponents/TextFields - MessagingUIViews/Core (~> 20.17) - Nimble (~> 9.2) - Nocilla (~> 0.12) - OHHTTPStubs/Swift - OptimizelySwiftSDK - SchibstedGigya (~> 0.9.0) - SchibstedSourcery (~> 0.4.0) - SDWebImage (~> 5.6) - SDWebImageSwiftUI (from `https://github.com/AdevintaSpain/SDWebImageSwiftUI.git`, branch `master`) - Shock - SnapshotTesting (~> 1.9.0) - SpearCore (= 1.4.0) - SpearUI (= 1.4.0) - SVProgressHUD - SwiftGen (~> 6.3) - SwiftInfo (~> 2.3) - SwiftLint - SwiftUIPager (= 2.3.2) - SwiftyJSON (~> 5.0) - XLPagerTabStrip (~> 9.0) SPEC REPOS: "git@github.mpi-internal.com:CocoaPods/Specs.git": - HighlanderFoundationKit - HighlanderTestKit - MessagingUIViews - Nocilla - XMPPFramework-Adevinta "git@github.mpi-internal.com:scmspain/ios-common--cocoapods-specs.git": - AdevintaLog - CollectionViewKit - FormBuilder - SchibstedGigya - SchibstedSourcery - SMImagePicker - SpearCore - SpearUI - VBMapPicker https://github.com/CocoaPods/Specs.git: - _NIODataStructures - Adevinta-Segment-Appboy - Analytics - analytics-ios-mcvid - AppAuth - Appboy-iOS-SDK - AppNexusSDK - AppsFlyerFramework - AXStateButton - CNIOAtomics - CNIODarwin - CNIOHTTPParser - CNIOLinux - CNIOWindows - CocoaAsyncSocket - ComScore - CropViewController - DBDebugToolkit - Didomi-XCFramework - EasyTipView - Firebase - FirebaseABTesting - FirebaseAnalytics - FirebaseCore - FirebaseCoreDiagnostics - FirebaseCoreInternal - FirebaseCrashlytics - FirebaseInstallations - FirebasePerformance - FirebaseRemoteConfig - FLAnimatedImage - Google-Mobile-Ads-SDK - GoogleAppMeasurement - GoogleDataTransport - GoogleSignIn - GoogleUserMessagingPlatform - GoogleUtilities - GRMustache.swift - GTMAppAuth - GTMSessionFetcher - KeychainAccess - KIF - KissXML - libidn - MaterialComponents - MDFInternationalization - MDFTextAccessibility - nanopb - Nimble - NMRangeSlider - OHHTTPStubs - OptimizelySwiftSDK - PromiseKit - PromisesObjC - SDWebImage - Shock - SnapshotTesting - Sourcery - SVProgressHUD - SwiftGen - SwiftInfo - SwiftLint - SwiftNIO - SwiftNIOConcurrencyHelpers - SwiftNIOCore - SwiftNIOEmbedded - SwiftNIOHTTP1 - SwiftNIOPosix - SwiftUIPager - SwiftyJSON - XLPagerTabStrip EXTERNAL SOURCES: Additions: :git: "git@github.mpi-internal.com:scmspain/ios-common--lib-additions.git" :tag: 0.2.0 AdevintaAnalytics: :path: "../ios-common--lib-analytics" AdPlacementManager: :git: "git@github.mpi-internal.com:scmspain/ios-common--lib-ad-placement-manager.git" :tag: 0.6.2 SDWebImageSwiftUI: :branch: master :git: https://github.com/AdevintaSpain/SDWebImageSwiftUI.git CHECKOUT OPTIONS: Additions: :git: "git@github.mpi-internal.com:scmspain/ios-common--lib-additions.git" :tag: 0.2.0 AdPlacementManager: :git: "git@github.mpi-internal.com:scmspain/ios-common--lib-ad-placement-manager.git" :tag: 0.6.2 SDWebImageSwiftUI: :commit: e8c5d446b32a9d215f10fbc9736bef255f41eb73 :git: https://github.com/AdevintaSpain/SDWebImageSwiftUI.git SPEC CHECKSUMS: _NIODataStructures: 3d45d8e70a1d17a15b1dc59d102c63dbc0525ffd Additions: d735e6f8ffe269e72b661a365078b31a26facec8 Adevinta-Segment-Appboy: d4741ac805480710d3b77b4964db5c8cb62b390c AdevintaAnalytics: 030fb86b18ced11fb06a19133fab113272147f09 AdevintaLog: d1d1f6ffc7ebd56d1ab0086321712bf4fa59a470 AdPlacementManager: efb5dc399ef2c5ca83d0bdb83007a7bbb7d11b3d Analytics: eefe524436f904b8bb3f8c8c3425280e43b34efc analytics-ios-mcvid: f30929689902042ecf16e5a98f33ca5da0d8a4cd AppAuth: 8fca6b5563a5baef2c04bee27538025e4ceb2add Appboy-iOS-SDK: dd22a28a003c5a1331080ecec398eaa4d7ef4569 AppNexusSDK: a68d8de1afcc3155eae58f862fa1e3144bf17002 AppsFlyerFramework: a664325124485223296354b4eec335f5340a6df8 AXStateButton: 6c515a433e37551505046429b5be04c12daa8c07 CNIOAtomics: 8edf08644e5e6fa0f021c239be9e8beb1cd9ef18 CNIODarwin: 93850990d29f2626b05306c6c9309f9be0d74c2f CNIOHTTPParser: 8ce395236fa1d09ac3b4f4bcfba79b849b2ac684 CNIOLinux: 62e3505f50de558c393dc2f273dde71dcce518da CNIOWindows: 3047f2d8165848a3936a0a755fee27c6b5ee479b CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 CollectionViewKit: bb343a291c904ea5124ae869297b98b770bc1b31 ComScore: b88ce67897ecd94c959051fa16e6784aab93174f CropViewController: 58fb440f30dac788b129d2a1f24cffdcb102669c DBDebugToolkit: b146dfb5fd94b2c57a40ffd173419b6fe5996b66 Didomi-XCFramework: 5c0771b420d3ecf538fe2b2b252b285e076764a1 EasyTipView: 4f8beae0a82db2ca4a9b5fd658785fc5f61d296b Firebase: 5ae8b7cf8efce559a653aef0ad95bab3f427c351 FirebaseABTesting: 61826730ce9eee8781ba99a2b3420e9bce148dc9 FirebaseAnalytics: 89ad762c6c3852a685794174757e2c60a36b6a82 FirebaseCore: 2082fffcd855f95f883c0a1641133eb9bbe76d40 FirebaseCoreDiagnostics: 99a495094b10a57eeb3ae8efa1665700ad0bdaa6 FirebaseCoreInternal: bca76517fe1ed381e989f5e7d8abb0da8d85bed3 FirebaseCrashlytics: 3210572ddb77801e5a0bd9d7bc890769f2066a0c FirebaseInstallations: 0a115432c4e223c5ab20b0dbbe4cbefa793a0e8e FirebasePerformance: f1e62598cd98c88ce6c10e0d26223d18b85c26d6 FirebaseRemoteConfig: ee09d77a7d7c7e31da6a0d1cf956cd611c85609c FLAnimatedImage: bbf914596368867157cc71b38a8ec834b3eeb32b FormBuilder: f2269d76aaef25ce4e697df3549ea3f887a680df Google-Mobile-Ads-SDK: 5a1d44987c82e441811ecaa5ae824e100ea819d7 GoogleAppMeasurement: 6de2b1a69e4326eb82ee05d138f6a5cb7311bcb1 GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a GoogleUserMessagingPlatform: 5f8b30daf181805317b6b985bb51c1ff3beca054 GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7 GRMustache.swift: a6436504284b22b4b05daf5f46f77bd3fe00a9a2 GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd GTMSessionFetcher: ffbb25ec00ebcb5201adab0a56d808f6f1902d9f HighlanderFoundationKit: e00d8137e91d50d3b26a1fd7a6f4bfc48f1b3e52 HighlanderTestKit: 9f7d299b0a4272cda2be70e438e8826b394fee25 KeychainAccess: d5470352939ced6d6f7fb51cb2e67aae51fc294f KIF: 779cdbca106633b94ecee7b036537490ebdbd9de KissXML: 5c8e0f2e8b9f071d3e1ae123dec3eb5da615c10c libidn: e4576a956b797c584c77aaedfc6e3dd639b61bdc MaterialComponents: 1a9b2d9d45b1601ae544de85089adc4c464306d4 MDFInternationalization: d697c55307816222a55685c4ccb1044ffb030c12 MDFTextAccessibility: f4bb4cc2194286651b59a215fdeaa0e05dc90ba5 MessagingUIViews: 64caeb60e61dcf1515ecc19ee887b2999c949bfa nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 Nimble: e7e615c0335ee4bf5b0d786685451e62746117d5 NMRangeSlider: 317ded652431eb90501c8421d9cddc3930d891e6 Nocilla: d3b845509ebd5c625a4a88de9d0be6ec48174159 OHHTTPStubs: 90eac6d8f2c18317baeca36698523dc67c513831 OptimizelySwiftSDK: 2e9af6d0e35c8f04f1f7f7a286bfa7899fc83cdd PromiseKit: 49d70c53d5d20e346beaea4b276b5dd2ab446bb4 PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb SchibstedGigya: f3789c034c4124309e728e08022ebd59de31d932 SchibstedSourcery: 3b207b5ff4f011af03cb72db2b384dab250627f6 SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 SDWebImageSwiftUI: 6b17a8db7b99ea263cf2c0721a18460edbd01153 Shock: 879b8614fcecaa2fff9c70000b0a675ba9c09d67 SMImagePicker: 959602dcff2ceb61cce160cfae57a1fd6e144f98 SnapshotTesting: 6141c48b6aa76ead61431ca665c14ab9a066c53b Sourcery: e0e8658a1ce6d9f475156ad3ffce4c68f1261b3e SpearCore: 519be5162849224854a3f0ed88f841bc04504e66 SpearUI: d3847b79003eec959c2fd44b1339a3bbdea66a0f SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 SwiftGen: 1366a7f71aeef49954ca5a63ba4bef6b0f24138c SwiftInfo: 8fa3deb26f30084411247606869a34ea5ec02a52 SwiftLint: 32ee33ded0636d0905ef6911b2b67bbaeeedafa5 SwiftNIO: 829958aab300642625091f82fc2f49cb7cf4ef24 SwiftNIOConcurrencyHelpers: 697370136789b1074e4535eaae75cbd7f900370e SwiftNIOCore: 473fdfe746534d7aa25766916459eeaf6f92ef49 SwiftNIOEmbedded: ffcb5147db67d9686c8366b7f8427b36132f2c8a SwiftNIOHTTP1: ef56706550a1dc135ea69d65215b9941e643c23b SwiftNIOPosix: b49af4bdbecaadfadd5c93dfe28594d6722b75e4 SwiftUIPager: 994249cf7ee9a10ea1fcd8e6643962bb17742fc6 SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e VBMapPicker: 932e0016c72fb17481887407de91b7f458147531 XLPagerTabStrip: 61c57fd61f611ee5f01ff1495ad6fbee8bf496c5 XMPPFramework-Adevinta: c0c4e271f94dfceaf7d8aeea8f7ceefce9c02127 PODFILE CHECKSUM: eb4381ea5276075c70ee22ffe0db33264c4efd39 COCOAPODS: 1.11.3 ```
google-oss-bot commented 1 year ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

rizafran commented 1 year ago

Thanks for reporting this, @miquelalvarado. I tried to replicate the issue and I was able to get the Analytics uninitialized error. However, I successfully got the value of sessionID() when I put it in a view controller instead in AppDelegate. I'll raise this to the team if this is an intended behavior or a bug.

miquelalvarado commented 1 year ago

Hi @rizafran, thanks for answering! In my case I tried it not even in the main view controller but in the third view controller of a navigation view controller and still was getting the error. The problem though, is that we need the sessionId as soon as possible (so didFinishLaunching) to be able to start sending events with the sessionID attached, to the GA4 Measurement Protocol.

miquelalvarado commented 1 year ago

Hi @rizafran, do you have any news on this issue?

tsunghung commented 1 year ago

Analytics is initialized in a background thread to avoid blocking the main thread. Thus, the sessionID may not be available right after the FirebaseApp.configure() call. You may want to retry when you see such errors.

miquelalvarado commented 1 year ago

Hi @tsunghung, thanks for answering! I tried retrying it and after 56378 iterations (literally) it keeps erroring. It doesn't seem to to even launch any asynchronous request but the closure is called automatically after requesting for the sessionId. I have the feeling there's a client-sided validation done which is returning the error. Is it possible?

tsunghung commented 1 year ago

Sorry, I don't have time to test it today. I will give it a try tomorrow. You probably should wait a little, e.g. 100ms, before retrying.

tsunghung commented 1 year ago
Task {
  var retry = 0
  while (true) {
    let sessionID = try? await Analytics.sessionID()
    if let sessionID {
      print("[test] retry:\(retry) sessionID:\(sessionID)")
      break
    }
    try await Task.sleep(nanoseconds: 100_000)
    retry += 1
  }
}

In my simple test app, it took around 1 second to initialize Analytics, and the retry count was around 10.

miquelalvarado commented 1 year ago

Hi @tsunghung, thanks for taking time for this, I've tried your same code and it's failing in my project:

if let filePath = plistPath,
    let options = FirebaseOptions(contentsOfFile: filePath) {
         FirebaseApp.configure(options: options)
}
Analytics.setAnalyticsCollectionEnabled(true)
Task {
    var retry = 0
    while(true) {
         do {
              let sessionID = try await Analytics.sessionID()
              print("[test] retry: \(retry) sessionID:\(sessionID)")
              break
         } catch let error {
              print("[test] errored in retry: \(retry) with error: \(error.localizedDescription)")
              try await Task.sleep(nanoseconds: 100_000)
        }
        retry += 1
   }
}

After executing it and waiting some time i can see in the console: [test] errored in retry: 17017 with error: Analytics uninitialized

I think there must be some kind of local validation done when calling FirebaseApp.configure() or when calling Analytics.sessionID() that may may be causing the error. Is it possible?

I've enabled debug mode adding the -FIRDebugEnabled argument and in the console i can see the following:

2022-10-20 09:32:14.980149+0200 fotocasa[99724:10123362] 9.6.0 - [FirebaseAnalytics][I-ACS023007] Analytics v.9.6.0 started

so it seems to configure Firebase properly. I'm attaching other console output just in case it gives you any useful information:

2022-10-20 09:32:14.769642+0200 fotocasa[99724:10123361] 9.6.0 - [FirebaseAnalytics][I-ACS025028] AdMob and Firebase are in use in this app, but are not linked. For analytics data consistency and integrity, it is highly recommended that you link your AdMob app to the corresponding Firebase app and re-download the GoogleServices-Info.plist file. See https://support.google.com/admob/answer/6383165 for more information.

2022-10-20 09:32:14.982281+0200 fotocasa[99724:10123362] 9.6.0 - [FirebaseAnalytics][I-ACS023207] To enable verbose logging set the following application argument: -FIRAnalyticsVerboseLoggingEnabled (see http://goo.gl/RfcP7r)

2022-10-20 09:32:15.053068+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 12979.86147284508

2022-10-20 09:32:15.256510+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement

2022-10-20 09:32:15.257758+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS029014] Successfully parsed a configuration. Version: 1664876552363186

2022-10-20 09:32:15.258420+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS023016] Analytics is ready to receive events

2022-10-20 09:32:15.262390+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS032006] Scheduling Search Ad Report timer

2022-10-20 09:32:15.263318+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS002002] Search Ad campaign report alarm scheduled to fire in approx. (s): 84946.61459875107

2022-10-20 09:32:15.265056+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS002002] Engagement timer scheduled to fire in approx. (s): 3600

2022-10-20 09:32:15.265980+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS023012] Analytics collection enabled

2022-10-20 09:32:15.266529+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS023220] Analytics screen reporting is enabled. Call Analytics.logEvent(AnalyticsEventScreenView, parameters: [...]) to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist

2022-10-20 09:32:15.266985+0200 fotocasa[99724:10123349] 9.6.0 - [FirebaseAnalytics][I-ACS023051] Logging event: origin, name, params: auto, screen_view (_vs), {

2022-10-20 09:32:15.356729+0200 fotocasa[99724:10123356] 9.6.0 - [FirebaseAnalytics][I-ACS023072] Event logged. Event name, event params: screen_view (_vs), {

2022-10-20 09:32:15.359882+0200 fotocasa[99724:10123356] 9.6.0 - [FirebaseAnalytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 0.2460490465164185

2022-10-20 09:32:15.637900+0200 fotocasa[99724:10123356] 9.6.0 - [FirebaseAnalytics][I-ACS002001] Measurement timer fired

2022-10-20 09:32:15.644969+0200 fotocasa[99724:10123356] 9.6.0 - [FirebaseAnalytics][I-ACS002003] Measurement timer canceled

2022-10-20 09:32:15.648624+0200 fotocasa[99724:10123356] 9.6.0 - [FirebaseAnalytics][I-ACS023105] Event is not subject to real-time event count daily limit. Marking an event as real-time. Event name, parameters: screen_view (_vs), {

2022-10-20 09:32:15.649957+0200 fotocasa[99724:10123409] 9.6.0 - [FirebaseAnalytics][I-ACS800014] Cannot get flag for unregistered flag. SDK name, flag name: app_measurement, session_stitching_token_feature_enabled

2022-10-20 09:32:15.661429+0200 fotocasa[99724:10123409] 9.6.0 - [FirebaseAnalytics][I-ACS012018] Saving bundle. size (bytes): 457

2022-10-20 09:32:15.662962+0200 fotocasa[99724:10123409] 9.6.0 - [FirebaseAnalytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 23, 1666251134605

2022-10-20 09:32:15.671032+0200 fotocasa[99724:10123356] 9.6.0 - [FirebaseAnalytics][I-ACS023039] Measurement data sent to network. Timestamp (ms), data: 1666251135669, <APMPBMeasurementBatch: 0x11db3d9a0>
miquelalvarado commented 1 year ago

So I have finally found the issue. There were some -quite historic- warnings in the console warning about same class being duplicated in both an internal framework and the main app target. So long story short, the root cause was having the static libraries 'FirebaseAnalytics' and 'GoogleAppMeasurement' in those two targets and thus, the compiler was not being able to successfully resolve the linking. After fixing it, i started receiving the sessionID.

For anyone here wondering how to solve the duplication of static libraries, you may want to check this stackoverflow question.

Thank you @tsunghung for the patience and the interest shown 🙇🏻‍♂️