Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


5,294 Points

Swift UILocalNotifications on specific Dates

I have an app that basically acts as an alarm clock that fires notifications on specific dates that are set by the user using a UIDatePicker.

Example: A user selects on the picker May 20, 2016, 3:40pm.

The user is then suppose to get an alert on that exact date. Moreover, the user has other alerts in the queue pending to happen. Say Another one is due before on May 10, 2016, 5:00pm so obviously this one fires first.

How can i accomplish this? I have an app with core data where the NSDate picked object is saved to core data and i am simply trying to fire the date using

myNotification.fireDate = coreData.dueDate

but this does not fire at all or randomly fires on several days after it was supposed to fire. And for the record, I do have a toggled switch that nils this out if its off. If its on, it shows the UIDatePicker for a date to be chosen to fire. Any help would greatly help or a sample project. Thanks