iOS limitation of 64 local notifications

为君一笑 提交于 2019-12-04 17:51:47
  1. You could routinely send a push notification to devices that have not contacted the backend in some time and have the remote notification handler setup local notifications up to the limit, see application(_:didReceiveRemoteNotification:fetchCompletionHandler:).

  2. Or, you could setup a background fetch that reschedules local notifications up to the limit using, see application(_:performFetchWithCompletionHandler:). Note that you cannot fully control how often this refresh is performed, but in my experience it is called up to a number of times a day.

When using either one of the above method, you can update local notifications even if the user never opens the apps.

Mandeep Kumar

I also had some kind of problem like this. So what I did is that I planned the notifications as much as possible, and when there is room to plan more notifications then I planned more notification.

UIApplication.sharedApplication().scheduledLocalNotifications?.count

You can get the number of planned notifications. Subtract it from 64 and plan remaining notifications.

In applicationWillEnterForeground you can do this -

if UIApplication.sharedApplication().scheduledLocalNotifications?.count < 64  

{

       //refersh list

 let nc = NSNotificationCenter.defaultCenter()
 nc.postNotificationName(Constants.SCHEDULE_MORE_NOTIFICATION, object: nil)

}

So your notification list will be refreshed automatically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!