UILocalNotification Maximum Discrepancy - ios

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.

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.

Show local notifications without limit

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.

How long does a push notification sit in queue before being removed?

I've been digging around trying to uncover some data for apple's push notifications for a client and something I have been unable to find an answer to is how long a push notification will sit in queue for an offline device before it will be removed.
There maybe long periods of time, 2-3 months for example, in which the device maybe inactive and powered off. I'm simply interested in knowing how long I can expect a notification to linger, waiting to be delivered to an offline device, before it gets automatically removed (which is what I understand to be what happens).
Official developer documentation isn't clear about this. From developer.apple.com:
Apple Push Notification Service includes a default Quality of Service
(QoS) component that performs a store-and-forward function. If APNs
attempts to deliver a notification but the device is offline, the QoS
stores the notification. It retains only one notification per
application on a device: the last notification received from a
provider for that application. When the offline device later
reconnects, the QoS forwards the stored notification to the device.
The QoS retains a notification for a limited period before deleting
it.
But according to PCWorld, it's 28 days:
If the app is running, it gets the notification immediately. If the
app isn't running, the notification is held in the phone to be
consumed at the app's next launch. If the iPhone is offline when the
sender attempts delivery, APNS attempts to send the notification for
28 days.
While 28 days may have been true in 2009, I wouldn't be surprised if its different today. The ambiguity in the documentation is a great excuse for Apple to change this timeout period willy-nilly.
Upon digging the docs I found out that we can use 'expiration date' parameter to control the queuing of APNS notifications.
Here is the detailed explanation on the usage of expiration date
apns-expiration
A UNIX epoch date expressed in seconds (UTC). This header identifies the date when the notification is no longer valid and can be discarded.
If this value is nonzero, APNs stores the notification and tries to deliver it at least once, repeating the attempt as needed if it is unable to deliver the notification the first time. If the value is 0, APNs treats the notification as if it expires immediately and does not store the notification or attempt to redeliver it.

Resources