Bug 53265 - AlertAction in UILocalNotification always null when receiving the notification
Summary: AlertAction in UILocalNotification always null when receiving the notification
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.8 (d15-1)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-03-12 02:05 UTC by Andres
Modified: 2017-03-14 01:43 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED ANSWERED

Description Andres 2017-03-12 02:05:11 UTC
Xamarin.iOS app

Target iOS 10

Running on iOS 10.2 Device

IDE: Xamarin Studio on Mac

Xamarin Info:

Xamarin Studio Enterprise
Version 6.2 (build 1821)
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000495


Xamarin.iOS:
Version: 10.4.0.123 (Visual Studio Enterprise)
Hash: 35d1ccd
Branch: cycle9
Build date: 2017-02-16 17:40:00-0500

Build Information
Release ID: 602001821
Git revision: d41b6e51f3fa46a1943f2e31a778d28a7c73d069
Build date: 2017-02-17 15:18:19-05
Xamarin addins: 1363a8d943bab7700c93a97474060b6734aa7f94
Build lane: monodevelop-lion-cycle9

Issue: 

Scheduling a local notification

    var notification = new UILocalNotification();
    notification.FireDate = NSDate.FromTimeIntervalSinceNow(0);
    notification.AlertTitle = "Title of the Alert";
    notification.AlertBody = "You just got a new notification";
    notification.AlertAction = "Ok cool";
    notification.SoundName = UILocalNotification.DefaultSoundName;
    UIApplication.SharedApplication.ScheduleLocalNotification(notification);

When receiving the notification:

    public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
    {
        // Notification AlertAction string is always null.
        var action = notification.AlertAction;
    }


I tried different values for the notification AlertAction but neither worked, it was always null.

NOTE: The above code runs fine when running on a device with iOS 9.3.
Comment 1 Timothy Risi 2017-03-13 23:24:51 UTC
I loaded up Xcode and ported the above code over and am seeing the same thing happen in Xcode as in Xamarin Studio.  AlertAction appears correctly in the iOS 9 simulator, but shows up as nil in the 10.0 simulator, so it appears this is something on apple's end, not an error in Xamarin.iOS.
Comment 2 Andres 2017-03-14 01:43:08 UTC
Yeah @Timothy, I was able to check that this morning. Migrated the same code to Swift and had the same error, was waiting to come back home to update this bug with this information.

It's Apple issue.

Thanks for your prompt reply.-