Push notifications
How it works
- The app asks the user for permission (
UNUserNotificationCenter.requestAuthorization) and registers with APNs (registerForRemoteNotifications()). - APNs (Apple Push Notification service) issues a device token — it arrives in
application(_:didRegisterForRemoteNotificationsWithDeviceToken:). The token is unique per app+device pair and may change (reinstall, restore from backup) — send it to your server on every launch. - Your server (or a provider: Firebase, OneSignal, Braze) sends the payload to APNs over HTTP/2 at
api.push.apple.com, specifying the device token. - APNs delivers the notification to the device; the system shows a banner or wakes the app.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep