Reputation:
I have an array of nsdates and I want to create a notification for each of them to happen when the time matches the current times.
so far i have this
for item in stuffThree {
print("test")
var notification:UILocalNotification = UILocalNotification()
notification.category = "test1"
notification.alertBody = "test2"
notification.fireDate = item
print(item)
UIApplication.sharedApplication().scheduleLocalNotification(notification)
}
As of now I am not getting anything. What i do is create a date a minute ahead and then let the clock tick down and wait and nothing happens.
Any ideas?
Upvotes: 0
Views: 115
Reputation: 1000
Try this.
notification.fireDate = NSDate(timeIntervalSinceNow: 5)
You should read This on HackingWithSwift. It should help you out.
Upvotes: 0
Reputation: 5188
A couple suggestions:
notification.alertBody = "Test"
localNotification.timeZone = NSTimeZone.defaultTimeZone()
print(notification.fireDate)
and
print(notification
)Upvotes: 1