Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let incrementAction = UIMutableUserNotificationAction()
- incrementAction.identifier = "OPEN_ACTION"
- incrementAction.title = "Open"
- incrementAction.activationMode = UIUserNotificationActivationMode.Background
- incrementAction.authenticationRequired = false
- incrementAction.destructive = false
- let counterCategory = UIMutableUserNotificationCategory()
- counterCategory.identifier = "SLAGBOOM_CATEGORY"
- counterCategory.setActions([incrementAction],
- forContext: UIUserNotificationActionContext.Default)
- counterCategory.setActions([incrementAction],
- forContext: UIUserNotificationActionContext.Minimal)
- let types = UIUserNotificationType.Alert
- let settings = UIUserNotificationSettings(forTypes: types, categories: NSSet(object: counterCategory) as? Set<UIUserNotificationCategory>)
- UIApplication.sharedApplication().registerUserNotificationSettings(settings)
- let notification:UILocalNotification = UILocalNotification()
- notification.alertBody = message
- notification.category = "SLAGBOOM_CATEGORY"
- UIApplication.sharedApplication().scheduleLocalNotification(notification)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement