如何在 Xamarin 中向 hockeyapp (appcenter) 崩溃报告添加附加信息?

How to add addtional information to hockeyapp (appcenter) crash report in Xamarin?

我正在关注这篇文章 https://support.hockeyapp.net/kb/client-integration-cross-platform/how-to-integrate-hockeyapp-with-xamarin 试图将更多信息添加到 hockeyapp 的崩溃数据中。

Collect crash reports: If your app crashes, a crash log is written to the device's storage. If the user starts the app again, they will be asked asked to submit the crash report to HockeyApp. This works for both beta and live apps, i.e. those submitted to the App Store. Crash logs contain viable information for you to help resolve the issue. Furthermore, you as a developer can add additional information to the report as well.

我在 https://support.hockeyapp.net/kb/client-integration-ios-mac-os-x-tvos/how-to-add-application-specific-log-data-on-ios-or-os-x from Add custom information to HockeyApp crash report 找到了一些示例代码,但它在 objective-c 和 swift 中,我如何在 Xamarin / c# 中执行此操作?

我假设您想使用 AppCenter 而不是 HockeyApp。 使用 AppCenter,您需要告诉 AppCenter 客户端应该注意什么。如果你想使用崩溃和分析,你的开始应该是这样的:

AppCenter.Start("YOUR KEY", typeof(Analytics), typeof(Crashes));

如果你想报告异常,你可以很容易地做到这一点:

Crashes.TrackError(exception);

可以用字典添加附加信息:

var additionalInformation = new Dictionary<string, string>();
additionalInformation.Add("TITLE", "VALUE");

Crashes.TrackError(exception, additionalInformation);