Bug 60728 - Enhanced User Notifications not displaying on iOS
Summary: Enhanced User Notifications not displaying on iOS
Alias: None
Product: iOS
Classification: Xamarin
Component: Samples ()
Version: XI 11.6 (xcode9.2)
Hardware: Other Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2017-11-16 18:13 UTC by Matt Morden
Modified: 2017-11-17 19:45 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Matt Morden 2017-11-16 18:13:49 UTC
I'm following the guide on Enhanced User Notifications, found at https://developer.xamarin.com/guides/ios/platform_features/user-notifications/enhanced-user-notifications/

However, the notifications will not display on iOS. I've tried running on iPhone simulators, and physical iPad devices. The request to receive notifications pops up, but the actual notification doesn't display when the code is triggered. 

In my AppDelegate, I've added the following (which works) in the FinishedLaunching method

    // Request notification permissions from the user
    UNUserNotificationCenter.Current.RequestAuthorization (UNAuthorizationOptions.Alert, (approved, err) => {
        // Handle approval

In my xaml.cs page, where I want the notification to be sent (currently hooked up to a button click event handler)

var content = new UNMutableNotificationContent ();
content.Title = "Notification Title";
content.Subtitle = "Notification Subtitle";
content.Body = "This is the message body of the notification.";
content.Badge = 1;

var trigger =  UNTimeIntervalNotificationTrigger.CreateTrigger (5, false);

var requestID = "sampleRequest";
var request = UNNotificationRequest.FromIdentifier (requestID, content, trigger);

UNUserNotificationCenter.Current.AddNotificationRequest (request, (err) => {
    if (err != null) {
        // Do something with error...
Comment 1 Matt Morden 2017-11-17 19:45:54 UTC
I fixed the issue by implementing the delegate willPresentNotification