Reputation: 1847
In my Xamarin iOS app I enabled AppCenter's Analytics and Crash how explained here: https://learn.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. In troubleshooting page there is written that on iOS cannot be more than a tool for exception handling, and this is the only one. In my app I enabled FCM so there is Firebase, I tried to remove any reference to Firebase but nothing changes.
Enabling 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". At the restart I see that SendingErrorReport
callback is called, but SentErrorReport
and FailedToSendErrorReport
are ignored.
After AppCenter.Start I tried to call 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.
In Symbols section I can read "You're awesome! There are no unsymbolicated crashes". I tried to compile in Debug and in Release. I tried to launch a new Exception and to use Crashes.GenerateTestCrash
.
I didn't have any problem using Analytics and Crash with a Xamarin.Forms app.
Upvotes: 4
Views: 7038
Reputation: 21899
Finally after lot of hit and trial I have found that you have to override a different FinishedLaunching
method, which provides UIApplication
& NSDictionary
params.
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
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Upvotes: 2
Reputation: 629
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, ...); }
Upvotes: 3