I don't want to receive notifications when I kill the application in swift

i I have a server that sends notifications with firebase to ios, I can receive notifications in the foreground and in the background, but when I kill the application the notifications keep coming. How can I stop them arriving?

Replies

For visible pushes, you'd have to build in something to prevent sending the push itself. It is by design that visible pushes are sent after the user killed the app. --> "Alert" notification.


For silent pushes see below:


This behavior is inconsistent with the documentation.


https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623013-application?language=objc


"However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again."


To clarify, as the user, you swipe away your application from app switcher, and the OS is relaunching it silently to deliver "content-available = true" push notifications?


Out of curiousity, what happens if you disable "background app refresh", or place your device in "low data mode". Both of these should also prevent "background fetch" from occurring. It would be interesting to see if this is not the case either with the latest OS version.


I recently ran into the same thing for my app on iOS 13.2.x. As a developer, I'd like the ability to wake up the app given the appropriate circumstance. As a user, I would NOT want every single app to be able to do this without giving it express permission to do so. Enough tracking of users as it is. If I remove an app from app-switcher, I intend for it to not be allowed to run.