Reputation: 66
In local notifications there is repeatInterval property where we can put the unit repeat intervals for minute, hour, day, week, year, etc.
I want that repeat interval on Prayer time hours and every day same process.
So every Prayer time hours the local notification comes.
Prayer time is everyday different times
How do I do that?
Upvotes: 1
Views: 779
Reputation: 5592
Simply try this :
NSCalendar *calen = [NSCalendar autoupdatingCurrentCalendar] ;
NSDateComponents *components = [calen components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute) fromDate:[NSDate date]];
[components setHour:9];
[components setMinute:30];
[components setSecond:00];
UILocalNotification *notif = [[UILocalNotification alloc]init];
notif.fireDate = [calen dateFromComponents:components];
notif.repeatInterval = NSCalendarUnitDay;
[notif setAlertBody:@"Its prayer time..."];
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
Hope it will work for you.
Upvotes: 0