firedate uhrzeit aller locale notifications ändern

SpecialFighter

Aktives Mitglied
Thread Starter
Dabei seit
25.04.2012
Beiträge
1.139
Reaktionspunkte
20
hallo alle zusammen,

gibt es eine möglichkeit, von allen vorhandenen locale notifications die Uhrzeit auf z.B. 12:00 Uhr zu setzen?
Habe es hiermit versucht, allerdings klappt es so 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) 12:00:00"
        dateFormatter.dateFormat = "dd.MM.yyyy HH:mm:ss"
        var NewFireDate = dateFormatter.dateFromString(FormatNewFireDate)

        // Neues FireDate setzen
        notification.fireDate = NewFireDate!
    }
 
Zurück
Oben Unten