[英]Visual Studio App Center: crashes and errors not working on Xamarin iOS
In my Xamarin iOS app I enabled AppCenter's Analytics and Crash how explained here: https://docs.microsoft.com/en-us/appcenter/sdk/getting-started/xamarin在我的 Xamarin iOS 应用程序中,我启用了 AppCenter 的分析和崩溃如何在这里解释: https : //docs.microsoft.com/en-us/appcenter/sdk/getting-started/xamarin
Analytics works, but I'm not able to see any crash/error on the Diagnostic section of App Center web console.分析有效,但我无法在 App Center Web 控制台的“诊断”部分看到任何崩溃/错误。 In troubleshooting page there is written that on iOS cannot be more than a tool for exception handling, and this is the only one.
在故障排除页面中写道,在 iOS 上不能只是一个用于异常处理的工具,这是唯一的一个。 In my app I enabled FCM so there is Firebase, I tried to remove any reference to Firebase but nothing changes.
在我的应用中,我启用了 FCM,因此有 Firebase,我尝试删除对 Firebase 的任何引用,但没有任何变化。
Enabling AppCenter.LogLevel = LogLevel.Verbose;
启用
AppCenter.LogLevel = LogLevel.Verbose;
I can see that when app crashes AppCenter tries to store the exception ("Storing a log to Crashes"), but after I can see a "Found an empty buffer position".我可以看到当应用程序崩溃时 AppCenter 尝试存储异常(“将日志存储到崩溃”),但在我看到“找到一个空的缓冲区位置”之后。 At the restart I see that
SendingErrorReport
callback is called, but SentErrorReport
and FailedToSendErrorReport
are ignored.在重新启动时,我看到调用了
SendingErrorReport
回调,但忽略了SentErrorReport
和FailedToSendErrorReport
。
After AppCenter.Start I tried to call await Crashes.SetEnabledAsync(true)
.在 AppCenter.Start 之后,我尝试调用
await Crashes.SetEnabledAsync(true)
。 If I let it crash and when I reopen the app I call ErrorReport crashReport = await Crashes.GetLastSessionCrashReportAsync()
crash report is always null.如果我让它崩溃并且当我重新打开应用程序时,我会调用
ErrorReport crashReport = await Crashes.GetLastSessionCrashReportAsync()
崩溃报告始终为空。
In Symbols section I can read "You're awesome! There are no unsymbolicated crashes".在符号部分,我可以读到“你太棒了!没有无符号的崩溃”。 I tried to compile in Debug and in Release.
我尝试在 Debug 和 Release 中编译。 I tried to launch a new Exception and to use
Crashes.GenerateTestCrash
.我试图启动一个新的 Exception 并使用
Crashes.GenerateTestCrash
。
I didn't have any problem using Analytics and Crash with a Xamarin.Forms app.我在 Xamarin.Forms 应用程序中使用 Analytics 和 Crash 没有任何问题。
This kind configuration works me as well:这种配置也适用于我:
using Microsoft.AppCenter.Crashes;
AppCenter.Start(Settings.AppCenterConfigString, typeof(Analytics), typeof(Crashes) /*, typeof(Push)*/);
Crashes.NotifyUserConfirmation(UserConfirmation.AlwaysSend);
Custom Exception (Error) logging:自定义异常(错误)日志记录:
catch (Exception e) { Crashes.TrackError(e, ...); }
https://docs.microsoft.com/en-us/appcenter/sdk/crashes/xamarin#ask-for-the-users-consent-to-send-a-crash-log https://docs.microsoft.com/en-us/appcenter/sdk/crashes/xamarin#ask-for-the-users-consent-to-send-a-crash-log
Finally after lot of hit and trial I have found that you have to override a different FinishedLaunching
method, which provides UIApplication
& NSDictionary
params.最后,经过大量的尝试和试验,我发现您必须覆盖不同的
FinishedLaunching
方法,该方法提供UIApplication
和NSDictionary
参数。
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
AppCenter.LogLevel = LogLevel.Verbose; //just so you can see in debug //that it is running successfully
AppCenter.Start(#your app id#, typeof(Crashes));
}
You are welcome ;-)不客气;-)
info.plist
info.plist
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.