0
異なるメッセージを使用してローカル通知を毎時間(1日だけ)送信します。また、新しい通知が来たら、以前の通知を却下したい。iOSインターバル異なるメッセージのローカル通知
私はこのコードを使用しましたが、セコンド通知は最初のものと同じテキストが付属しています! と前...
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)