Je le code suivant:Convertir NSCalendarUnit à Swift2
var notification = UILocalNotification()
notification.alertBody = "Message" // text that will be displayed in the notification
notification.fireDate = NSDate() // right now (when notification will be fired)
notification.soundName = UILocalNotificationDefaultSoundName // play default sound
let calendar = NSCalendar.currentCalendar()
let components = calendar.components([.Minute], fromDate: NSDate())
notification.repeatInterval = NSCalendarUnit.CalendarUnitHour // this line defines the interval at which the notification will be repeated
UIApplication.sharedApplication().scheduleLocalNotification(notification)
mais il est désapprouvée. Cherché beaucoup, mais ne pouvait pas le convertir en Swift2. Quelqu'un peut-il m'aider avec la ligne:
notification.repeatInterval = NSCalendarUnit.CalendarUnitHour
Il suffit d'utiliser '.Hour' –
@LeoDabus Je l'ai fait, mais cela ne fonctionne pas. Il n'envoie pas de notification =/ –
Checki as-tu enregistré pour les notifications? http://stackoverflow.com/a/34575836/2303865 –