DidRegisterForRemoteNotificationsWithDeviceToken - Push Notifications

I just wanted to confirm that "didRegisterForRemoteNotificationsWithDeviceToken" is intended to be called every time the application loads, and my PHP server or application needs to deal with the possibility of re-sending to memory in my database? Or am I missing something?

Thanks james

+4
source share
1 answer

First, you should not call this method directly. Rather, you should call registerForRemoteNotificationTypes: each time you launch your application, which then, in turn, calls application:didRegisterForRemoteNotificationsWithDeviceToken: which you must implement.

Secondly, yes, you must resend the token to your server each time. From the documentation:

By requesting a device token and passing it to the provider each time your application starts, you help ensure that the provider has the current token for the device. If the user restores a backup on a device other than the one on which the backup was created (for example, the user transfers data to a new device), he must run the application at least once so that he receives notifications again. If a user restores backup data to a new device or reinstalls the operating system, the device token changes. Moreover, never cache the device token and do not pass it to your provider; Always get a token from the system when you need it. If your application has previously registered, calling registerForRemoteNotificationTypes: causes iOS to transfer the device token to the delegate immediately, without any additional overhead.

+16
source

Source: https://habr.com/ru/post/1337129/


All Articles