UILocalNotificaiton
gets called twice in one post.
Does anybody know the reason?
I found it in iOS9.1. But in iOS8.0 it works normally.
Below is my code:
extension UILocalNotification {
class func postNotification(message : String!, soundName : String?) {
dispatch_async(dispatch_get_main_queue()) { () -> Void in
let localNotification : UILocalNotification = UILocalNotification()
localNotification.fireDate = NSDate().dateByAddingTimeInterval(1)
localNotification.timeZone = NSTimeZone.defaultTimeZone()
localNotification.alertBody = message
localNotification.repeatInterval = NSCalendarUnit(rawValue: 0)
if soundName != nil {
localNotification.soundName = soundName
} else {
localNotification.soundName = UILocalNotificationDefaultSoundName
}
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
}
}
}