0
votes

I have an app on the iPad. It is not showing the badge on app icon when notification comes or server send statically. I have registered notification with badge option, but still, the badge is not appearing on the app icon. Also When I check settings -> Notification -> My App. It is not showing toggle for the badge. Only showing alert & sound, no badge. Here, I have attached an image of the setting in the notification.

Link: [https://prnt.sc/s7rnj0]

My code is as follows:

Link: [https://prnt.sc/s7sp9u]

Calling this from didFinishLaunchingWithOptions

1
Can i ask how you impletement notfication in your app using firebase or other??Anjali Shah
Not using firebase, using UNUserNotificationJaini
Ok Fine, you can refer this : stackoverflow.com/a/40634374/10584330Anjali Shah

1 Answers

1
votes
func registerForPushNotifications() {
    if #available(iOS 10.0, *) {
               let center  = UNUserNotificationCenter.current()
               let content = UNMutableNotificationContent()
                content.sound = UNNotificationSound.default
               center.delegate = self
                UNUserNotificationCenter.current().delegate = self
                center.requestAuthorization(options: [.sound, .alert, .badge]) 
     { (granted, error) in
                   if error == nil{
                       DispatchQueue.main.async {
                           UIApplication.shared.registerForRemoteNotifications()
                       }
                   }
               }

           } else {

               let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
               UIApplication.shared.registerUserNotificationSettings(settings)
               UIApplication.shared.registerForRemoteNotifications()
           }
}

//register push notification method call on didFinishLaunchingWithOption method in app delegate. below ipad snap.

ipad snap