阅读背景:

使用Swift 2的iOS 9本地通知

来源:互联网 

I have the following code

我有以下代码

@IBAction func triggerNotif(sender: UIButton) {
    let dateComp:NSDateComponents = NSDateComponents()
    dateComp.year = 2015
    dateComp.month = 11
    dateComp.day = 12
    dateComp.hour = 21
    dateComp.minute = 30
    dateComp.timeZone = NSTimeZone.systemTimeZone()

    let calender:NSCalendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)!
    let date:NSDate = calender.dateFromComponents(dateComp)!

    let notification:UILocalNotification = UILocalNotification()
    notification.alertBody = "body of notification"
    notification.fireDate = date
    notification.repeatInterval = NSCalendarUnit.Day

    UIApplication.sharedApplication().scheduleLocalNotification(notification)
}
@IBAction 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: