问题
With Fabric, it was the following (answered here):
Crashlytics.sharedInstance().version
With Firebase:
- the instance is
Crashlytics.crashlytics()
, but there is no version on it - nothing of interest in FIRCrashlytics.h
- Since
Crashlytics
is anNSObject
,Crashlytics.version
exists, but it's equal to 0. - I also looked on the
FirebaseCrashlytics
module to no avail.
The Crashlytics version is actually printed in the console when running FabricApp.configure
in the AppDelegate
, so it's clearly defined somewhere, but I need to access it to display it in the app:
${time_stamp} ${app_name}[${process_id}] [Firebase/Crashlytics] Version 4.3.1
回答1:
The API was added to Firebase/Crashlytics 7.1.0: https://firebase.google.com/docs/reference/ios/firebasecore/api/reference/Functions#/c:@F@FIRFirebaseVersion
Swift:
FirebaseCore.FirebaseVersion()
Objc
FIRFirebaseVersion()
回答2:
Chintan from Firebase here. This has just been implemented in the latest version of Crashlytics iOS SDK (7.0.1). So from now on Crashlytics will use the same version as iCore, so here’s the API for it: https://firebase.google.com/docs/reference/ios/firebasecore/api/reference/Functions
来源:https://stackoverflow.com/questions/64706652/how-to-programmatically-get-crashlytics-version-with-firebase-on-ios