问题
Can any one help me with integrating Firebase.Crashlytics on a Xamarin.Forms project for iOS. It is working fine for me on Android but on iOS I am facing issues. Note that I have performed the following steps on iOS :-
Added Xamarin.Firebase.iOS.Crashlytics Nuget package to my iOS project.
Added GoogleService.plist file
Made a dependency service for iOS
Added the following code to initialize the nuget :-
Firebase.Core.App.Configure(); Crashlytics.Configure(); Fabric.Fabric.SharedSdk.Debug = true; Crashlytics.SharedInstance.Crash();
Update
I have followed all the steps in the below mentioned link :- https://keithbeattyblog.wordpress.com/2019/06/16/xamarin-forms-adding-google-firebase-crashylitics/ Still nothing works.
When I follow the steps written in the above article I face issues where I am unable to build my project due to the 'Xamarin.Build.Download' NuGet package. Also I face issues where I am unable to deploy the solution to my Simulators because it doesn't allow me select a simulator to run the App.
Any help would be appreciated. Thanks!
回答1:
Are you sure you want still go with the old Fabric implementation? You must be aware that the Fabric Crashlytics version is deprecated, right?
All of us were received a mail from Google informing that:
We are writing to let you know that the Fabric Crashlytics SDK is now deprecated and will continue reporting your app's crashes until November 15, 2020. After this date, the Fabric Crashlytics SDK and beta versions of the Firebase Crashlytics SDK will stop sending crash reports for your app.What happened? We are replacing Fabric Crashlytics SDKs and beta versions of the Firebase Crashlytics SDKs with the generally available Firebase Crashlytics SDKs.What's Next? To continue getting crash reports in the Firebase console, make sure to upgrade your apps to the Firebase Crashlytics SDK versions 17.0.0+ for Android, 4.0.0+ for iOS, and 6.15.0+ for Unity before November 15, 2020.Android
So everything is going to change soon, and you shouldn't use the Fabric solution anymore, especially for new projects.
You can found the new official nuget package here, but it is still in preview:
https://www.nuget.org/packages/Xamarin.Firebase.Crashlytics/117.0.0-preview02
This is the official repository issue to add comments: https://github.com/xamarin/XamarinComponents/issues/956
When you'll add this new package and the google-services.json you will need to change the following in your old code:
- Every
CrashLytics.Crashlytics
reference will be justFirebaseCrashlytics
. - No initialization is needed, you can get the
FirebaseCrashlytics.Instance
anywhere - To log an exception you will need to use the
RecordException
method instead of the oldLogException
SetUserIdentifier
is changed toSetUserId
, andSetUserName
is no longer there- There is no method to crash on purpose anymore, so now you have to simply throw any exception you want if you wanna test your implementation
Maybe I'm missing something, but basically, that's all.
回答2:
Update Xamarin.Firebase.iOS.Crashlytics
to version 4.0.0-beta.7
and in your app delegate just call
Firebase.Core.App.Configure();
Firebase.Analytics.Analytics.LogEvent(Firebase.Analytics.EventNamesConstants.SelectContent, new Dictionary<object, object> {
{ Firebase.Analytics.ParameterNamesConstants.ItemId, "hokisit-ios" },
{ Firebase.Analytics.ParameterNamesConstants.ItemName, "Hokisit iOS" }
});
来源:https://stackoverflow.com/questions/63190025/how-do-i-integrate-firebase-crashlytics-on-my-xamarin-forms-project