Is it possible to schedule SILENT local notification in iOS?

I am trying to schedule a notification locally since I do not yet have the required structure in the backend. The idea is that after an X period of time, certain conditions are checked; and if done, a regular local notification is triggered.

This can be easily achieved, for example, using a timer, but some of these periods are long enough (1 hour, 24 hours) that this does not work.

This is how I end up thinking about local notifications. I could schedule one happy birthday + 24 hours. The thing is, I need it to be quiet in order to check the conditions.

In the section configuring a local notification here it seems that only remote notification can be quiet, but in fact he says that he can not do.

In addition, I found that you can initiate a local notification with nothing but an icon, and it will change the icon. Although callbacks in my AppDelegate are never called.

I saw some people say that this cannot be done, but they did not find real solid official evidence. Has anyone been able to do this? Or know for sure, this is actually impossible? Any advice would be very helpful, thanks in advance!

+6
source share
1 answer

I tried and had the same experience as you - callbacks are never called when my application is not in the foreground. This is by design. Apple's documentation states that a callback is only called when your application is in the foreground userNotificationCenter:willPresentNotification:withCompletionHandler: https://developer.apple.com/reference/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter?language=objc

The only callback method for receiving notifications when the application is not in the foreground is didReceiveRemoteNotification , but, unfortunately, it is intended only for push notifications (quiet or different). https://developer.apple.com/reference/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter?language=objc

+3
source

All Articles