简体   繁体   English

Visual Studio 应用中心:崩溃和错误在 Xamarin iOS 上不起作用

[英]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回调,但忽略了SentErrorReportFailedToSendErrorReport

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方法,该方法提供UIApplicationNSDictionary参数。

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 ;-)不客气;-)


  1. Error logs will be uploaded the next time app loads, so crash it on a button click, then close the app and remove it from recent apps.错误日志将在下次加载应用程序时上传,因此单击按钮使其崩溃,然后关闭应用程序并将其从最近的应用程序中删除。
  2. Start the app again and wait couple of moments, then see the web UI再次启动应用程序并等待几分钟,然后看到 Web UI
  3. Depending upon the OS version you also have to add following code into the info.plist根据操作系统版本,您还必须将以下代码添加到info.plist

 <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio App Center Analytics不适用于Xamarin Forms Android项目 - Visual Studio App Center Analytics Not working for Xamarin Forms Android Project Visual Studio Xamarin安卓应用程序崩溃 - Visual Studio Xamarin android app crashes Xamarin:从 Visual Studio 将 iOS 发布到 App Store 无效 - Xamarin: publish iOS to App Store from Visual Studio no working 在 Visual Studio App Center for Xamarin iOS 中构建失败:只有在使用 /unsafe 编译时才会出现不安全的代码 - Build fails in Visual Studio App Center for Xamarin iOS: Unsafe code may only appear if compiling with /unsafe Visual Studio(xamarin)的IOS应用程序超时 - timeout with IOS app from Visual Studio (xamarin) Xamarin Visual Studio ios 模拟器不工作 - Xamarin Visual Studio ios simulator not working SetSupportActionBar在visual studio和Xamarin中崩溃了 - SetSupportActionBar crashes in visual studio and Xamarin 使用Visual Studio 2015的Xamarin iOS工作应用无法在iPhone 4和5上启动 - Working Xamarin iOS App Fails to Launch on iPhone 4 and 5 using Visual Studio 2015 Visual Studio 2015中的Xamarin本机PCL-新应用错误 - Xamarin Native PCL in Visual Studio 2015 - New App errors Xamarin应用程序在iOS 10.3中崩溃,但在11以上版本中运行 - Xamarin app crashes in iOS 10.3 but working in version above 11
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM