Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Push notification
- if #available(iOS 10.0, *) {
- let center = UNUserNotificationCenter.current()
- center.requestAuthorization(options: [.badge, .alert , .sound]) { (granted, error) in
- UIApplication.shared.registerForRemoteNotifications()
- }
- } else {
- let type: UIUserNotificationType = [UIUserNotificationType.badge, UIUserNotificationType.alert, UIUserNotificationType.sound]
- let setting = UIUserNotificationSettings(types: type, categories: nil)
- UIApplication.shared.registerUserNotificationSettings(setting)
- UIApplication.shared.registerForRemoteNotifications()
- }
Add Comment
Please, Sign In to add comment