Is it bad practice to call registerForRemoteNotificationTypes
in applicationDidBecomeActive
? I was calling it in applicationDidFinishLoading
, but with multitasking, the registration was not happening for days to weeks for some users.
I'd like to call the registration more often, but don't want to call it this often if it's bad practice.
It is not bad practice.
In fact Apple documentation says this: Apple documentation
If your application has previously registered, calling
registerForRemoteNotificationTypes:
results in iOS passing the device token to the delegate immediately without incurring additional overhead.
Device tokens can change.
Your app needs to reregister every time it is launched in iOS by calling the
registerForRemoteNotificationTypes:
method ofUIApplication
.
Based on Local and Push Notification Programming Guide
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With