2016-05-03 5 views
-1

Wie kann ich eine lokale Benachrichtigung planen, die jeden Mittwoch und Samstag um 12 Uhr lokale Gerätezeit auslöst?Planen Sie die lokale Benachrichtigung an einem bestimmten Tag und zu einer bestimmten Uhrzeit.

let localNoonSatNotification:UILocalNotification = UILocalNotification() 
    localNoonSatNotification.userInfo = ["uid":"noonBreak"] 
    localNoonSatNotification.alertAction = "Noon Break" 
    localNoonSatNotification.alertBody = "Time for a break! Come and play few levels" 
    localNoonSatNotification.fireDate = // get next Wednesday/Saturday 12:00 PM 
    localNoonSatNotification.soundName = UILocalNotificationDefaultSoundName 
    localNoonSatNotification.applicationIconBadgeNumber = 1 
    UIApplication.sharedApplication().scheduleLocalNotification(localNoonSatNotification) 
+1

Mögliche Duplikat [jeden bestimmten Tag der Woche Lokale Benachrichtigung] helfen (http://stackoverflow.com/ Fragen/35101186/lokale-Benachrichtigung-jeden-spezifischen-Wochentag) –

Antwort

1

Sie Wiederholungsintervall festlegen können,

notification.repeatInterval = NSCalendarUnit.CalendarUnitWeekday 

Hope this wird :)

Verwandte Themen