Ahhh, that's quite helpful! I should mention that I'm very new to iOS development. The willPresent is being called but as you mentioned, only in the foreground. I have additional print statements in my actual code that show that the function is called and that the notification with the correct identifier was received, and I am then calling removeDeliveredNotifications but the notification remains. I basically already had these two functions in my code for handling existing notifications so I put it in there but perhaps I was wrong to do so. I am sending a push notification that updates the badge count, and includes the custom payload to specify which notifications to dismiss. But if no notification is actually displayed as a result of this push, would it not allow me to remove the notification?
I will have to check out the notification service extension later!