0
Я хочу отправить локальное уведомление каждый час (всего на один день) с другим сообщением. Также хотите отменить предыдущее уведомление, когда появится новый.Местное уведомление iOS с различным сообщением
Я использовал этот код, но уведомление Seccond поставляется с тем же текстом, что и первый! и не Уволить Предыдущая ...
UIApplication.sharedApplication().cancelAllLocalNotifications()
var Text = "!!!!!!!!!"
let Texts = [
"11111111111",
"22222222222",
"33333333333",
"44444444444",
"55555555555"
]
Text = Texts[Int(arc4random_uniform(UInt32(Texts.count)))]
let localNotification:UILocalNotification = UILocalNotification()
localNotification.alertAction = "Testing notifications on iOS8"
localNotification.alertBody = Text
localNotification.fireDate = NSDate(timeIntervalSinceNow: 1)
localNotification.soundName = UILocalNotificationDefaultSoundName
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
let localNotification2:UILocalNotification = UILocalNotification()
localNotification2.alertAction = "Testing notifications on iOS8"
localNotification2.alertBody = Text
localNotification2.fireDate = NSDate(timeIntervalSinceNow: 5)
localNotification2.soundName = UILocalNotificationDefaultSoundName
UIApplication.sharedApplication().scheduleLocalNotification(localNotification2)