Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

neftali
neftali
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