iOS Push Notifications - update badge without alert?

后端 未结 4 605
自闭症患者
自闭症患者 2020-12-28 18:34

Is there a way to update the number in the badge without showing an alert or opening the app?

I am writing an app that should always display the current number of un

4条回答
  •  悲哀的现实
    2020-12-28 19:01

    you should use applicationIconBadgeNumber for locally handling your app badge number

    [UIApplication sharedApplication].applicationIconBadgeNumber = number_of_notifications;
    

    I don't think it is possible to do without alert as far as adding badge counter from remote notification. You should read about APN Service, in your case you might register for UIRemoteNotificationTypeBadge you should read about Local & Push Notification Programming guide

提交回复
热议问题