Clicky

iOS Dev Nugget 26 Do not prompt user to enable push notifications immediately

.

Need to run a code review on your codebase? Hire me

Many code samples — including Apple's — puts the call to -registerForRemoteNotificationTypes in -application:didFinishLaunchingWithOptions: and that's what many developers end up doing.

For many apps, the app has not yet have a chance to establish its value to the user. So there's a good chance the user will not enable push notifications if the prompt appears the first time the app launches.

Consider showing the prompt only after the user does a certain action such as having walked through a walkthrough screen, or at least describe to the user why it would be good for them to enable push notifications for this app.

It's good practice though to call -registerForRemoteNotificationTypes for each subsequent launch to make sure you always get the latest user device token (since the user might have upgraded to a new device and restored from iTunes backup), so you probably still want to add the call to -registerForRemoteNotificationTypes in -application:didFinishLaunchingWithOptions:, just make sure to not do it for new users.


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues