I use the code snippet below to schedule a local binding at a specific time. But the notification is repeated every minute, and not after one day. I missed any notification settings. My time zone is (Asia / Calcutta (IST) offset 19800) and using iPhone 4s.
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar] ;
NSDate *now = [NSDate date];
NSDateComponents *components = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute) fromDate:now];
[components setHour:12];
[components setMinute:00];
UILocalNotification *notification = [[UILocalNotification alloc]init];
notification.fireDate = [calendar dateFromComponents:components];
[notification setAlertBody:@"U got notification!!!"];
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
source
share