Apple iPhone Forum und Community

Normale Version: datum aller locale notifications ändern
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hallo zusammen,

gibt es eine Möglichkeit via swift, das FireDate Datum aller Locale Notifiaction auf x Uhr zu setzen?

Habe folgendes getestet - funktioniert allerdings nicht:

Code:
 var app:UIApplication = UIApplication.sharedApplication()
       for oneEvent in app.scheduledLocalNotifications {
           var notification = oneEvent as! UILocalNotification
         
           // String aus Notification.FireDate formatieren
           var dateFormatter = NSDateFormatter()
           dateFormatter.dateStyle = NSDateFormatterStyle.MediumStyle
           dateFormatter.dateFormat = "dd.MM.YYYY"
           var strDate = dateFormatter.stringFromDate(notification.fireDate!)
         
           // Neues NSDate Firedate aus String machen
           dateFormatter.dateFormat = "dd.MM.yyyy"
           var FormatNewFireDate = "\(strDate) 09:00:00"
           dateFormatter.dateFormat = "dd.MM.yyyy HH:mm:ss"
           var NewFireDate = dateFormatter.dateFromString(FormatNewFireDate)
         
           // Neues FireDate setzen
           notification.fireDate = NewFireDate!
       }