Do Local Notifications need user permission on iOS?

RPM picture RPM · Apr 17, 2013 · Viewed 13.1k times · Source

I am using UILocalNotification in my app to schedule notifications. The notifications work fine and show up when I want them to. I dont have an issue with that. I am NOT doing any remote/push notifications.

What got me wondering is that I never saw the famous permissions dialog that you usually see for push notifications in several app. I even reset my device and ran my app. That still didn't cause the permission dialog to show up.

Does this permission dialog not show up if your app is using only local notifications or am I not implementing some method that actually causes the app to ask for this permission?

I know I could implement my own dialog after the app started that asked the user for this permission but I was hoping that Apple took care of that, especially since it treats remote and local notifications the same in the Settings app.

Answer

luvieere picture luvieere · Oct 30, 2014

Yes, in iOS8, local notifications do require permissions.

The documentation for registerUserNotificationSettings: stipulates that

If your app displays alerts, play sounds, or badges its icon while in the background, you must call this method during your launch cycle to request permission to alert the user in those ways. Typically, you make this request if your app uses local or push notifications to alert the user to new information involving your app.

It is recommended that you call this method before you schedule any local notifications or register with the push notification service.