2
votes

I'm integrating Flurry Analytics into my Xamarin/MonoTouch iOS App with the following binding: https://github.com/mono/monotouch-bindings/tree/master/FlurryAnalytics

Now, I'd like to use Flurry Analytic's error logging:

void LogError (string errorID, string message, NSException exception);

I'm catching exceptions with this code in my AppDelegate:

AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => { /**/ };

However, as far as I can figure out Xamarin/MonoTouch has converted all NSExceptions to System.Exception.

Can System.Exception be converted back to NSException so I can use it in the LogError routine?

Or is it possible to catch NSExceptions in a Xamarin/MonoTouch project?

1

1 Answers

1
votes

Why not use the UncaughtExceptionHandler in the AppDelegate class? They have a sample on the github page you mentioned.

static void UncaughtExceptionHandler(IntPtr handle)
        {

            var exception = new NSException(handle);
            FA.Flurry.LogError("3584", exception.Reason, exception);

            Console.WriteLine(@"Got an exception...{0} -- {1}", exception.Name, exception.Reason);
        }

https://github.com/mono/monotouch-bindings/blob/master/FlurryAnalytics/sample/Xamarin.FlurryAnalyticsSample/AppDelegate.cs

Edit: The sample also shows how to log a System.Exception in the AnalyticsViewController.cs