Xamarin + UrbanAirship Component

Hello,

Has anyone been able to successfully apply the UrbanAirship component from the Component store?

I did all the necessary steps but it seems to have a null pointer at UAirship.Push.UserPushNotificationsEnabled = true;

Posts

  • JesseMockJesseMock USUniversity ✭✭

    I am also having the same issue. I have added the AirshipConfig.plist and have the following, where I am getting the same exception:

    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.Init ();
    
        UAirship.TakeOff ();
    
        UAirship.Push.UserPushNotificationsEnabled = true;  //This is where there is a NullReferenceException
    
        LoadApplication (new App ());
    
        return base.FinishedLaunching (app, options);
    }
    
  • JesseMockJesseMock USUniversity ✭✭
    edited January 2016

    @ChristineLuong I figured it out.

    Make sure you do the following:

    Set the Build Action on the AirshipConfig file to Content and the Copy to output directory to Always copy to have the file copied to the device.
    

    That will get it working for you.

  • ChristineLuongChristineLuong USUniversity

    Awesome, @JesseMock ! Thanks so much! Will be making that change and let you know.

  • RyanLepinskiRyanLepinski USMember

    I believe you can also set the build action as BundleResource.

  • OnurHazarOnurHazar USUniversity ✭✭✭

    UAirship.Push can be null if the app keys, secrets (Dev, Prod) are not properly set in AirshipConfig.plist.

  • ChristineLuongChristineLuong USUniversity

    Doing what was suggested by @JesseMock worked! :smile:

  • Hi all,

    AirshipConfig.plist needs to be copied over the app bundle when building – the most straightforward way is set BundleResource as the build action. It's also fine to instantiate and configure a UAConfig instance in code and pass that directly to takeOff, if that's easier. The platform docs at http://docs.urbanairship.com/platform/xamarin.html should be updated soon with that extra information.

Sign In or Register to comment.