Bug 2702 - UIApplication.SharedApplication.ScheduledLocalNotifications returns 0 local notifications even if there are scheduled ones
Summary: UIApplication.SharedApplication.ScheduledLocalNotifications returns 0 local n...
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.0
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2011-12-30 16:56 UTC by Patrik
Modified: 2012-01-10 09:14 UTC (History)
1 user (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 Patrik 2011-12-30 16:56:06 UTC
When adding local notifications, the notifications fire properly at the correct time, however checking UIApplication.SharedApplication.ScheduledLocalNotifications to see what notifications that are stored for the application returns nothing. (Which I previously used to traverse scheduled notifications in order to be able to cancel a specific notification, it worked before, perhaps pre MT 5.0?)

Code snippet to add notifications:
var notify = new UILocalNotification ();
notify.AlertAction = "Reminder";
notify.AlertBody = "Tick tock!";
notify.HasAction = true;
notify.SoundName = UILocalNotification.DefaultSoundName;
notify.FireDate = DateTime.Now.AddMinutes(5);
notify.TimeZone = NSTimeZone.DefaultTimeZone;			UIApplication.SharedApplication.ScheduleLocalNotification (notify);

Snippet to traverse notifications:
var notes = UIApplication.SharedApplication.ScheduledLocalNotifications;
foreach (UILocalNotification note in notes) 
.. do something ...
Comment 1 Patrik 2012-01-10 09:14:56 UTC
By calling UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(..) the  UIApplication.SharedApplication.ScheduledLocalNotifications works.

I think it's a bug/undocumented feauture of iOS5 and not MonoTouch related.