简体   繁体   中英

Firebase Analytics function not being recognized

I just followed the iOS firebase guide for setting up crashlytics and analytics and whenever I try to use the analytics functions, they aren't being recognized.

The IDE throws this error Type 'Analytics' has no member 'logEvent' whenever I try to use the following function

Analytics.logEvent(AnalyticsEventSelectContent, parameters: [
  AnalyticsParameterItemID: "id-\(title!)",
  AnalyticsParameterItemName: title!,
  AnalyticsParameterContentType: "cont"
  ])

I've even tried importing all the following at the top of the file and the same thing occurs.

import FirebaseAnalytics
import Firebase
import FirebaseCore
import FirebaseCrashlytics
import FirebaseInstallations

These are the Firebase libraries that get added when I run pod install

Installing Firebase (6.33.0)
Installing FirebaseAnalytics (6.8.3)
Installing FirebaseCore (6.10.3)
Installing FirebaseCoreDiagnostics (1.7.0)
Installing FirebaseCrashlytics (4.6.1)
Installing FirebaseInstallations (1.7.0)

And these are the ones I specify in the podfile

    pod 'Firebase/Crashlytics'
    pod 'Firebase/Analytics'

...apparently our project had an enum namespace named 'Analytics' that was overriding the library. This was confirmed when I called the function with Firebase.Analytics.logEvent()

:(

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM