nsdate - iPhone Local Notifications and UIDatePickers: How to set a banner notification/ alarm that repeats daily -


i've got local notifications set users can select time on datepicker (hour, minute, , am/pm) when notifications sent. works fine... until next day. seems notification works on same day, , resets once midnight hits. how prevent alarm resetting, notification sent daily?

here's code far:

(ibaction)schedulenotification:(id)sender {     uilocalnotification *notification = [[uilocalnotification alloc]init];     nsdate *firedate = _datepicker.date;     [notification setfiredate:firedate];     [notification setalertbody:@"daily reminder"];     [notification setalertaction:@"go app"];      [[uiapplication sharedapplication]schedulelocalnotification:notification];  //local push notifications }  (ibaction)didchangedatepicker:(id)sender {     nslog(@"new reminder time selected: %@",self.datepicker.date); } 

you need add:

[notification setrepeatinterval:nsdaycalendarunit]; 

it recur every day until cancel with:

[[uiapplication sharedapplication] cancellocalnotification:notification]; 

or

[[uiapplication sharedapplication] cancelalllocalnotifications]; 

which way cancels notifications set app.

too, well-presented in documentation if search on uilocalnotification.


Comments