Search code examples
xamarin.iosappsflyerappsflyer-ios-sdk

AppsFlyer Xamarin iOS binding, null reference exception


https://github.com/AppsFlyerSDK/XamariniOSBinding

Is anyone able to get this repo running?

I am hitting an null reference exception on startup because the tracker object is null - although this is bound as a static in the API Definition

// +(AppsFlyerTracker *)sharedTracker;
        [Static, Export ("sharedTracker")]
        AppsFlyerTracker SharedTracker ();

Solution

  • I was having the exact same issue and I found out what the problem is. I was testing this using the simulator.

    The AppsFlyer SDK returns null for the AppsFlyerTracker.SharedTracker() method if the app is running on the simulator. Make sure that you run the app on a real device, and that you check for a null before calling methods on SharedTracker() otherwise you'll get a NullPointerException from Xamarin.