Updating iOS badge without push notifications

前端 未结 6 1462
挽巷
挽巷 2020-11-28 20:25

I have seen a few todo apps that update their app badges at midnight, always showing the correct number of due tasks. They do this without the use of Push Notificat

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 20:53

    Try this

    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
    

    To do this through local notifications you have to set the value in applicationIconBadgeNumber

    UILocalNotification *localNotification = [[UILocalNotification alloc] init];
    localNotification.applicationIconBadgeNumber = 1;// set here the value of badge
    

提交回复
热议问题