我想安排本地通知,如文本上的第一天,「2日」第二天一樣,「1天」:有沒有什麼辦法可以每天安排不同文本的本地通知?
let notificationSettings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
let notification = UILocalNotification()
notification.fireDate = // ex: 5 am
notification.alertBody = "Day 1" // on second day it want to be "Day 2" , on third day it want to be "Day 3" like that..
notification.alertAction = "be awesome!"
notification.soundName = UILocalNotificationDefaultSoundName
notification.userInfo = ["CustomField1": "w00t"]
UIApplication.sharedApplication().scheduleLocalNotification(notification)
是否有可能做到這一點?
用戶將接收的第一天的通知爲「1日」
第二天爲「第2天」
第三天爲「3日」
是否有可能設置通知像那樣?
是的,你指望它一整天,然後更改文本。 – Khuong
對不起,無法得到你所說的。請解釋我... –
我的意思是你必須計算時間長= 1天。然後改變文字。 – Khuong