Ich möchte ein UILocalNotification
festlegen, das jeden Freitag automatisch einmal pro Woche wiederholt wird. Ich verwende derzeit den unten stehenden Code, um eine Benachrichtigung einmal am Tag zur selben Zeit zu wiederholen, aber ich bin mir nicht sicher, wie ich dies für die Woche erstellen soll.UILocalNotification Wiederholen Einmalig Wöchentlich
Danke
let calendar: NSCalendar! = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)
let now: NSDate! = NSDate()
let notifDate = calendar.dateBySettingHour(19, minute: 0, second: 0, ofDate: now, options: NSCalendarOptions.MatchFirst)!
var notification = UILocalNotification()
notification.category = "Reminder"
notification.alertTitle = "Alert"
notification.alertBody = "Alert body"
notification.fireDate = notifDate
notification.soundName = UILocalNotificationDefaultSoundName
notification.repeatInterval = NSCalendarUnit.Day
UIApplication.sharedApplication().scheduleLocalNotification(notification)
Ändern Sie repeatInterval in NSCalendarUnit. WeekOfYear. Es wird jede Woche zur selben Zeit wiederholt. – brl214
Es scheint keine "NSCalendarUnit.Week" zu geben. Es gibt einen Fehler, der besagt: Typ 'NSCalendarUnit' hat kein Mitglied 'Woche' –
Seine "NSCalendarUnit.WeekOfYear" – brl214