Is APNs device token sent to iOS?

Hi,

When a push notification is received from APNs to iOS within the iPhone, how does iOS know which app to provide the notification payload to?

Is device token also handed over by the APNs to the iOS, and used by iOS to know the right app to which the notification payload belongs?

Apple developer information reg. Push Notifications only indicate that that Device token is included by the app server in its request to APNs, and is used by the APNs to identify the correct device to forward the notification to. It does not mention if the APNs also forwards the device token to iOS, and is used by iOS to identify the target app.

https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns

Thanks in advance! /Isaac

When a push notification is received from APNs to iOS within the iPhone, how does iOS know which app to provide the notification payload to?

iOS knows which app, by the apns-topic value; either explicitly defined in the push request, or implicitly through the certificate your push server uses when it connects to APNs. The push server must be authorized to send a push to that app either by a certificate, or an authorization (JWT) token which must be generated by the same developer team which created the app.

Yes, the device Token is sent to the device. Is it passed to your app after the app registers for push notifications by calling UIApplication.registerForRemoteNotifications. The OS will call back into your app passing the device token as the second parameter to the callback application(_:didRegisterForRemoteNotificationsWithDeviceToken:).

https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622958-application https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns

Is APNs device token sent to iOS?
 
 
Q