Forum Xamarin Xamarin.iOS

Azure Push Notification not open my app

danielparedes97danielparedes97 Member ✭✭✭
edited August 2019 in Xamarin.iOS

I have a Xamarin Forms App and when I receive a notification, If I click on it, from an android device, I open the app without any problem, but If I do the same with iOS, I receive the notification, with my text and my title, but when I click the notification, suddenly it try to open the app, but the app finally crash

Can anyone help me??


  • LandLuLandLu Member, Xamarin Team Xamurai

    When you click the notification to open the app on iOS DidReceiveRemoteNotification will be called if you didn't implement UserNotifications.
    Please check the code in your DidReceiveRemoteNotification did you place some invalid stuff there.

    However, if you have implemented UserNotifications after iOS 10 you need to check the DidReceiveNotificationResponse event.

  • danielparedes97danielparedes97 Member ✭✭✭

    @LandLu First of all, I need to say that It worked perfectly before, I only have updated the Visual Studio to the last version (16.2.3). After that, the nuget package Microsoft.Azure.Mobile.Client have a new preliminar version (4.1.2), I have installed the 4.1.1, I don`t know if that can be influence. And I find a warning in the AppDelegate (I attach image).

    Finally, this is my DidReceiveRemoteNotification code:

    public override void DidReceiveRemoteNotification(
                UIApplication application,
                NSDictionary userInfo,
                Action<UIBackgroundFetchResult> completionHandler)
                // This will be called if the app is in the background/not running and if in the foreground.
                // However, it will not display a notification visually if the app is in the foreground.
            void PresentNotification(NSDictionary dict)
                // Extract some data from the notifiation and display it using an alert view.
                NSDictionary aps = dict.ObjectForKey(new NSString("aps")) as NSDictionary;
                var msg = string.Empty;
                if (aps.ContainsKey(new NSString("alert")))
                    msg = (aps[new NSString("alert")] as NSString).ToString();
                if (string.IsNullOrEmpty(msg))
                    msg = "(unable to parse)";
                CrossLocalNotifications.Current.Show("TituloApp" ,msg, 0, DateTime.Now.AddSeconds(2));
                MessagingCenter.Send<object, string>(this, App.NotificationReceivedKey, msg);


    ![]( "")
  • LandLuLandLu Member, Xamarin Team Xamurai

    Can you debug this error to post the messages of the exception?

  • danielparedes97danielparedes97 Member ✭✭✭
    edited September 2019

    @LandLu Sorry, but I can't debug the error, I receive the notification on release mode. I discovered yesterday that If I click the notification, the app opens on background.

Sign In or Register to comment.