خرید بک لینک

Vote count: 0

I've mixed and matched code from tutorials and have :

@IBAction func scheduleLocal(sender: AnyObject) {
var getCurrentYear = dateFire.year
var getCurrentMonth = dateFire.month
var getCurrentDay = dateFire.day

dateFire.year = getCurrentYear
dateFire.month = getCurrentMonth
dateFire.day = getCurrentDay
dateFire.hour = 15
dateFire.minute = 1
dateFire.timeZone = NSTimeZone.defaultTimeZone()

var calender: NSCalendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)!
var date: NSDate = calender.dateFromComponents(dateFire)!


guard let settings = UIApplication.sharedApplication().currentUserNotificationSettings() else { retu }

if settings.types == .None {
    let ac = UIAlertController(title: "Can't schedule", message: "Either we don't have permission to schedule notifications, or we haven't asked yet.", preferredStyle: .Alert)
    ac.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
    presentViewController(ac, animated: true, completion: nil)
    retu
}

let notification = UILocalNotification()
notification.fireDate = date
notification.alertBody = "Hey you! Yeah you! Swipe to unlock!"
notification.alertAction = "be awesome!"
notification.soundName = UILocalNotificationDefaultSoundName
notification.userInfo = ["CustomField1": "w00t"]
UIApplication.sharedApplication().scheduleLocalNotification(notification)
}
}

Before, I was using this code to send a local notification with a time interval from now, but I want to be able to set it to a specific time..

I wanted a notification to go off at 3:01, and this is my code for that. No notification went off.

What am I missing?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 6 خرداد 1395 ساعت: 2:29

صفحه بندی