Skip to content

Instantly share code, notes, and snippets.

@susanna2222
Created August 20, 2019 07:42
Show Gist options
  • Save susanna2222/433bb64b9e81016f2e222afd94aa136e to your computer and use it in GitHub Desktop.
Save susanna2222/433bb64b9e81016f2e222afd94aa136e to your computer and use it in GitHub Desktop.
func setupUserNotificationCenter(){
// request to receive notification
notificationCenter.requestAuthorization(options: [.alert, .sound, .badge, .carPlay], completionHandler: { (granted, error) in
if (error != nil) {
print("Notification Authorization Error: " + error!.localizedDescription)
}else{
print("Notification Authorization Granted: " + granted.description)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment