Guest User

Untitled

a guest
Jul 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // Push notification
  2.  
  3. if #available(iOS 10.0, *) {
  4. let center = UNUserNotificationCenter.current()
  5. center.requestAuthorization(options: [.badge, .alert , .sound]) { (granted, error) in
  6. UIApplication.shared.registerForRemoteNotifications()
  7. }
  8. } else {
  9. let type: UIUserNotificationType = [UIUserNotificationType.badge, UIUserNotificationType.alert, UIUserNotificationType.sound]
  10. let setting = UIUserNotificationSettings(types: type, categories: nil)
  11. UIApplication.shared.registerUserNotificationSettings(setting)
  12. UIApplication.shared.registerForRemoteNotifications()
  13. }
Add Comment
Please, Sign In to add comment