Post

Replies

Boosts

Views

Activity

Disabling remote push notifications in app
I am trying to figure out what the best way is of implementing a "toggle notifications on / off" switch in iOS using the SwiftUI framework. Calling unregisterForRemoteNotifications() seems to be one solution, but it's not recommended, as I understand from the docs. Another solution is to send a request to the provider server to set the token to inactive. But how would I handle this if the user happens to be offline when the toggle is switched, and comes online later? Any notificatins already sent would then arrive from APNs, I guess? The user could disable notifications in systems settings, which I assume just mutes the notification on an iOS level? Is there a way to replicate this within the app itself? I understand that the user settings can't be manipulated directly. But what is the recommended way of handling this situation (if there is one)? Thanks in advance!
2
0
2.0k
Nov ’22