Question

My app sets the application icon badge number locally. It reflects the number of rows in a table view.

Do I need to ask the user for permission to do it?

Do I need to register the app to appear in the notification center? By no means do I use push notifications.

If I'm just setting the icon badge number and not using UILocalNotifications.

Was it helpful?

Solution 2

No, you can increase it anytime you want. This is not push notification feature so does not require user permissions.

OTHER TIPS

No, You can use it anywhere.This is not only in case push notification, somebody use it for chat count also. So there is no need to get user permission. And also, No need to register to notification center if not use UILocalNotifications.

You don't need any user authorization to use :

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];

Also, the UILocalNotification class has a property called applicationIconBadgeNumber that will let you set the icon badge number when you send local notifications.

For iOS10+, you need to do this before you can setApplicationIconBadgeNumber

UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top