Registering for Push Notifications
Request permission and obtain a device token.
How Push Works End to End
A push notification travels from your server, through Apple Push Notification service (APNs), to a specific device. The device proves its identity with a device token APNs issued. Before any of this, the user must grant permission and the app must register.
// Flow: App registers -> APNs returns device token ->
// you send token to your server -> server pushes via APNsThe Notification Center
UNUserNotificationCenter is the single object you use for everything local and remote: requesting authorization, setting the delegate, scheduling local notifications, and reading settings. Get the shared instance.
import UserNotifications
let center = UNUserNotificationCenter.current()
// All notification configuration goes through centerAll lessons in this course
- Registering for Push Notifications
- Handling Notification Payloads
- Background Tasks and Refresh
- Notification Actions and Categories