Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. let incrementAction = UIMutableUserNotificationAction()
  2. incrementAction.identifier = "OPEN_ACTION"
  3. incrementAction.title = "Open"
  4. incrementAction.activationMode = UIUserNotificationActivationMode.Background
  5. incrementAction.authenticationRequired = false
  6. incrementAction.destructive = false
  7.  
  8. let counterCategory = UIMutableUserNotificationCategory()
  9. counterCategory.identifier = "SLAGBOOM_CATEGORY"
  10.  
  11. counterCategory.setActions([incrementAction],
  12. forContext: UIUserNotificationActionContext.Default)
  13.  
  14. counterCategory.setActions([incrementAction],
  15. forContext: UIUserNotificationActionContext.Minimal)
  16.  
  17. let types = UIUserNotificationType.Alert
  18. let settings = UIUserNotificationSettings(forTypes: types, categories: NSSet(object: counterCategory) as? Set<UIUserNotificationCategory>)
  19. UIApplication.sharedApplication().registerUserNotificationSettings(settings)
  20.  
  21. let notification:UILocalNotification = UILocalNotification()
  22. notification.alertBody = message
  23. notification.category = "SLAGBOOM_CATEGORY"
  24. UIApplication.sharedApplication().scheduleLocalNotification(notification)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement