I read through the documentation for UILocalNotification, and the example shows using NSDateComponents, and then setting the week, day, month, etc in order to schedule the notification. I'm basically trying to do something similar to an alarm clock that would repeat daily at a specific time. I have a time in UIPickerView and I create a NSDate from that time for my object. So I grab the time and I try to schedule the notification like so:
NSDate *date = [dateFormatter dateFromString:s];
NSCalendar *calender = [NSCalendar currentCalendar];
NSLog(@"%@", s);
UILocalNotification *note = [[UILocalNotification alloc] init];
note.alertAction = alarm.name;
note.alertBody = alarm.note;
note.fireDate = date;
note.timeZone = [[NSCalendar currentCalendar] timeZone];
note.repeatInterval = NSDayCalendarUnit;
note.timeZone = [NSTimeZone systemTimeZone];
[[UIApplication sharedApplication] scheduleLocalNotification:note];
Can I do that? Or do I have to use NSDateComponents. My code currently does not fire a notification and I was wondering if it's even possible to fire a notification this way, or if you have to use NSDateComponents.
Also, if I do have to use NSDateComponents, how do I just get the current day so I can set my alarm for that day and I'm assuming from there the repeatInterval would take effect for the next days.
Thanks a bunch!