Let me just say that the book indeed offers a deep dive into push notifications and related matters. I really liked it. There would be one topic that I would have like to read for example and that I had to deal with in my code base.
In chapter 13 it is mentioned how one can remove delivered notifications and this is applied to local notifications. It would be nice to have a section in the book about how to remove push notifications. Of course you would use the same method as for Local notifications but the process is not always straight forward. For example:
Let’s suppose in an app users receive “new offer” notifications. If one of the users accepts the offer this notification should be removed from other users notification screens. One way to do it is sending a silent notification. This hits
didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler. Here we then call a handler that would do any logic. For simplicity let’s call it
The issue that we found here is that calling
removeDeliveredNotifications is not that straight forward. We had to first call
beginBackgroundTask, execute the
remove function and then
endBackgroundTask. Thats because
removeDeliveredNotifications closure needs to run in the background.
So this is just to give an idea of what complication can arise and would be really nice if this would be discussed in the book.