0Pricing
Swift Academy · Lesson

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 APNs

The 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 center

All lessons in this course

  1. Registering for Push Notifications
  2. Handling Notification Payloads
  3. Background Tasks and Refresh
  4. Notification Actions and Categories
← Back to Swift Academy