0

Sorry if this is a duplicate, but I couldn't find this question for swift.

I need to create a local notification that fires everyday at 7.00 AM. I think the user has to go on the app at least once for the notification to start, so after they have launched the app, they never have to go on it again and the notification just fires everyday automatically.

How do I do this in Swift?

Daniel Waghorn
  • 2,997
  • 2
  • 20
  • 33
zacreme
  • 169
  • 1
  • 12
  • Look at this question. http://stackoverflow.com/questions/31567984/how-to-put-notifications-on-ios-application-to-repeat-every-one-1-hour/ – Reynaldo Aguilar Aug 03 '15 at 14:48
  • That doesn't answer my question. That is how you repeat a notification every 1 hour, not how to set it to repeat from a certain time, in my case, 7.00 AM. – zacreme Aug 03 '15 at 14:50
  • possible duplicate of [how to create local notifications in iphone app](http://stackoverflow.com/questions/6047117/how-to-create-local-notifications-in-iphone-app) – s1ddok Aug 03 '15 at 14:54
  • You can find a tutorial in an already answered question. http://stackoverflow.com/questions/6047117/how-to-create-local-notifications-in-iphone-app – s1ddok Aug 03 '15 at 14:54
  • possible duplicate http://stackoverflow.com/questions/31567984/how-to-put-notifications-on-ios-application-to-repeat-every-one-1-hour/ – Victor Sigler Aug 03 '15 at 16:32

1 Answers1

1

Old question, but:

var dateComponent = DateComponents()
dateComponent.hour = 7
dateComponent.minute = 0

let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponent, repeats: true)