Jafar Khoshtabiat
Jafar Khoshtabiat

Reputation: 703

what happens behind the scenes of executing `UIApplication.shared.registerForRemoteNotifications()` in iOS?

I'm wondering what's happening behind the scenes when registering ios applications for push notifications and how the ios device receives device-token in application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) callback. I need to know the complete scenario and protocol communication.

Upvotes: 0

Views: 121

Answers (2)

Jafar Khoshtabiat
Jafar Khoshtabiat

Reputation: 703

the most related things I could find are:

https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html

https://developer.apple.com/library/archive/technotes/tn2265/_index.html

what I could understand is that most of the work is done by os that establishes a direct and persistent connection to apple's servers. no more information about any protocols or request-responses.

Upvotes: 0

iOS Developer
iOS Developer

Reputation: 470

So this all works like this:

1) Your app asks to be registered with APNs.

2) On successful registration, APNs sends an app-specific device token to the device.

3) The system delivers the device to your app by calling a method in your app delegate.

For more information, check these links :- https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/HandlingRemoteNotifications.html

https://nshipster.com/apns-device-tokens/

Upvotes: 0

Related Questions