DevPrep

All topics › IDEs & SDK

Push notifications

Middle PRO

How it works

  1. The app asks the user for permission (UNUserNotificationCenter.requestAuthorization) and registers with APNs (registerForRemoteNotifications()).
  2. 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.
  3. 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.
  4. 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

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store