I want to fire a UILocalNotification
in a specific Date. If I use this code:
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorian components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:[NSDate date]];
[components setHour:4];
[components setMinute:0];
NSDate *fireDate = [gregorian dateFromComponents:components];
If now it's 3 pm this works fine, but it doesn't when, for example, it's 5 pm.
How can I set the notification fire date to "the next 4 pm" ?
In swift 3 - 4 you can use this for specific time local notification.
Try following code with 24 hour format:-