Show local notifications without limit - ios

I have a swift 2 app in which you can create entries in Core Data.
Each entry will register a local notification.
The problem is the limit of 64 local notifications.
Is there an way to solve this "problem" with the limitation?

Kind of (thanks #dfri). However, repeated notifications only count as one notification, but it appears that you have 64 completely independent notifications.
From the Local and Remote Notification Programming Guide:
Each app on a device is limited to 64 scheduled local notifications. The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.
The only semi-viable alternative is (see this repo):
Hope that your users open your app within 64 notifications.
Schedule remaining notifications.

Related

Is the iOS Local Notification Limit Per Day?

I'm working on an app where I need to send a good amount of notifications to the user daily. Around 5-40 depending on the user.
I'm using local notifications to send it, but I know there is a 64 notification limit. Does this mean 64 notifications per day, or in total?
It means simultaneously scheduled for future delivery. You can send as many as you want per day, provided they don't overlap.
If you add more than 64 requests (under UserNotifications) or scheduled (under UIApplication/UILocalNotification), the older ones will be dropped and not delivered.
Unfortunately iOS limits the local schedule notification up to 64. May be to prevent this issue can schedule first group of notification initially and then schedule another group when launch the app next time.

iOS local notifications disabled automatically if app isn't opened

As I see in many apps when setting user notifications as reminders, it works fine but after a while when the user starts to ignore opening the notification or the app it won't send any more notifications.
Is there a way to disable this behavior and continue sending the notifications even if they don't open the app?
What you are describing sounds like local notifications. These are scheduled in code to go off at a specific time. As far as I know there is no such thing as a recurring local notification. They are "simulated" by creating many single local notifications to begin with.
Edit
As PaulW pointed out. Recurring notifications are possible but are rarely used due to their limitations.
When the app is opened it runs some code to create some more local notifications.
If the app is not opened then the code never runs to create the additional notifications.
So, in this example, it is not iOS stopping the recurring notifications because you haven't opened the app. The notifications stop recurring because you don't open the app and give it the opportunity to create more of them.
So, to answer your question. No. The only way to delay this as long as possible is to create notifications that cover a long time into the future. But then I believe there is a limit to the number of scheduled notifications. (A quick google comes up with a limit of 64 scheduled notifications per app).
Edit you could also use repeating notifications but they are limited to repeat every one unit of time. Once a day, once and hour, once a minute, etc... so you can't do it every two hours.
Alternatively you could use a backend to send remote notifications. These could theoretically recur infinitely because the app is not required to create them. Of course, this assumes you have the infrastructure setup to develop this.

Is ios blocking local notifications considered as harmful?

I have an app made with phonegap which is using a third-party plugin for displaying local notifications. (https://github.com/katzer/cordova-plugin-local-notifications)
I deployed it on my device, and in the beginning it worked well. However after the app sent dozens of notifications (very frequently and with same text) at some point my iphone started not showing the notifications. I tried to delete the app, and deploy again, then the confirmation dialog popped up again for allowing notifications from the app, but they still didn't show up.
When i deployed it on an other device, it worked well again, also in the emulator.
Is it possible that ios somehow blocked notifications from this app, because it considered them as harmful/spam?
Maximum number of scheduled notification is 64. If you are reached the maximum you can't add more local notifications without removing the old ones or after firing the scheduled notifications.
In the apple documents, it mentions as follows
Each app on a device is limited to 64 scheduled local notifications.
The system discards scheduled notifications in excess of this limit,
keeping only the 64 notifications that will fire the soonest.
Recurring notifications are treated as a single notification.
There is a limit of 64 scheduled notifications per app, so, if you schedule more - only first 64 will arive.
Each app on a device is limited to 64 scheduled local notifications. The system discards scheduled notifications in excess of this limit, keeping only the 64 notifications that will fire the soonest. Recurring notifications are treated as a single notification.
However, there is a way to be sure that all 64 are scheduled - just pass them in packs by 64 notifications each.
Check this answer for more info.

iOS limitation of 64 local notifications

I know that this topic is a duplicate, but I need your help. It is very important for me and the other posts have no really an solution for me.
I have an app (Swift 2) where the user can save entries in core data. These entires will show in a table view.
The user has to set an reminder date (with a date picker) for each entry. This date will use for the fire date of the local notification.
Each entry get 2 local notifications
First fire date: 1 week before the chosen date, second fire date: chosen date
The problem is the Apple limitation of 64 local notifications.
The user can only save 32 entries (32 entries * 2 notifications = 64 notifications)
How can I solve this problem with the limitation?
I know that I can set "reminder" into the Apple calendar instead of local notifications. But this doesn't looks good - this shouldn't be the solution.
I know that I can check on each app start or in the method did receive notification, which notifications should set next. but for this I have to trust, that the user start the app or tap on the received notification. If he or she doesn't do this for a few days => no new notification will set and he or she doesn't get the next notification. This solution isn't very safe.
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:).
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.
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.

UILocalNotification Maximum Discrepancy

In Apple's Local and Push Notification Programming Guide, it says:
Each application on a device is
limited to the soonest-firing 64
scheduled local notifications. The
operating system discards
notifications that exceed this limit.
It considers a recurring notification
to be a single notification. LINK
However, in the iOS Application Programming Guide, it says
Listing 4-3 shows an example that
schedules a single alarm using a date
and time that is set by the user. This
example configures only one alarm at a
time and cancels the previous alarm
before scheduling a new one. (Your own
applications can have no more than 128
local notifications active at any
given time, any of which can be
configured to repeat at a specified
interval.) LINK
Which of these is true? Do I get 64 notifications or 128 notifications?
I finally did a test, and the answer is 64 local notifications.

Resources