I am trying to implement local notification
This is what I have set
// Current date
NSDate *date = [NSDate date];
// Add one minute to the current time
NSDate *dateToFire = [date dateByAddingTimeInterval:20];
// Set the fire date/time
[localNotification setFireDate:dateToFire];
[localNotification setTimeZone:[NSTimeZone defaultTimeZone]];
Instead of 20, I want to put a fixed time(daily)to start push.
For ex:I want to push notification pop up at every 6:00AM.
How can do that ?
Thanks
You just need to properly create a
NSDateobject to be your fire date (time). Instead of using[NSDate dateByAddingTimeInterval: 20], use something like this:Here are the Apple NSDateComponents API docs
And then when you add the date to the notification, set the repeat interval to one day:
As with all date related code, make sure to test how this works during the switch to daylight savings time, if your time zone uses daylight savings time.