How to repeat UILocalNotification daily at 5 pm ? Following is my code to set custom time. But i want to notify the user daily at custom or may be static time. I am using iO
Use this. It may help you
NSDateFormatter *dat= [[NSDateFormatter alloc]init];
[dat setLocale:[NSLocale currentLocale]];
[dat setTimeZone:[NSTimeZone systemTimeZone]];
//[dat setDateFormat:@"YYYY-MM-dd"];// YYYY-MM-dd hh:mm a
//NSString *dateM=[dat stringFromDate:datM];
//[dat setDateFormat:@"YYYY-MM-dd h:mm a"];
NSDate *reminderDate=[NSDate date];
reminderDate =[reminderDate dateByAddingTimeInterval:1*24*60*60];
UILocalNotification *missingDreamNotify=[[UILocalNotification alloc]init];
missingDreamNotify.fireDate=reminderDate;
missingDreamNotify.timeZone = [NSTimeZone defaultTimeZone];
missingDreamNotify.alertBody = @"Reminder is set";
missingDreamNotify.alertAction = @"Show me";
missingDreamNotify.soundName = UILocalNotificationDefaultSoundName;
missingDreamNotify.applicationIconBadgeNumber = 1;
missingDreamNotify.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:missingDreamNotify];