I am new to iOS development, but have created the app and I am trying to create a daily notification for specific time like (10AM). Now notification are coming too many if i se my mobile device time to 10AM. I want to trigger a local notification only once at given specific time that is at 10 AM , and I want to repeat this daily. What is the best method to repeat the notification daily ?
Here is my code
func fire(){ let dateComp:NSDateComponents = NSDateComponents() dateComp.hour = 10 dateComp.minute = 00 dateComp.timeZone = NSTimeZone.systemTimeZone() let calender:NSCalendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierIndian)! let date:NSDate = calender.dateFromComponents(dateComp)! let localNotificationSilent = UILocalNotification() localNotificationSilent.fireDate = date localNotificationSilent.repeatInterval = NSCalendarUnit.Day localNotificationSilent.alertBody = "Started!" localNotificationSilent.alertAction = "swipe to hear!" localNotificationSilent.timeZone = NSCalendar.currentCalendar().timeZone localNotificationSilent.category = "PLAY_CATEGORY" UIApplication.sharedApplication().scheduleLocalNotification(localNotificationSilent) }