我有按钮执行此操作:
@IBAction func pressed() {
var notif = UILocalNotification()
notif.fireDate = NSDate(timeIntervalSinceNow: 5)
notif.alertBody = "some text"
UIApplication.sharedApplication().scheduleLocalNotification(notif)
notif.timeZone = NSTimeZone.defaultTimeZone()
}
我按下它,但没有发生。有什么问题?
答案 0 :(得分:0)
试试这个:
var localNotification = UILocalNotification()
localNotification.fireDate = NSDate(timeIntervalSinceNow: 5)
localNotification.alertBody = "Bienvenido a Neku!"
localNotification.timeZone = NSTimeZone.defaultTimeZone()
localNotification.applicationIconBadgeNumber = UIApplication.sharedApplication().applicationIconBadgeNumber + 1 UIApplication.sharedApplication().scheduleLocalNotification(localNotification)