xamarin.ios

Harry

Posted on
Jun 10 2014

So where do i register in the appdelegate? Is there some hook like application_error in mvc where i can put my raygun.send

I thought to put it in the finishedlaunching method...

please give me a syntax example. i have no idea how the example with a main method would work in the current xamarin.ios version.


Jason Fauchelle

Raygun

Posted on
Jun 10 2014

Hello Harry

In your Xamarin.iOS project, there should be a file named Main.cs. This file contains the Application class which has a Main method. Within this method, place the following code before the call to UIApplication.Main:

RaygunClient.Attach("YOUR_APP_API_KEY");

This Attach method will automatically hook into all the necessary events to send all unhandled exceptions for you. If however you need to manually send unhandled exceptions (so that you can send custom data), then rather than using RaygunClient.Attach, you can attach event handlers to the following Xamarin.iOS static events where you can manually call the Send method on a RaygunClient instance:

AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

If your project does not have a Main.cs file, please let me know what type of project you chose in Xamarin Studio.

Hope that helps! Let me know if you have further questions about setting up Raygun in Xamarin.iOS.

-Jason Fauchelle


Reply