Our application uses UserNotificationCenter to deliver notifications of missed calls to the lock screen. Some times we need to remove this notification. I've tried to use removeDeliveredNotificationsWithIdentifiers APIs to remove the exact notification, but approximately in 10% tests it doesn't work.
The issue happens when the app is in background, the user receives a APNS call, but answers on it from other endpoint, so for the app this call is missed. But after call history update it should be marked as answered and a missed call notification should be removed.
From console logs I've found that for a good case system logs an attempt to remove a notification:
default 14:31:03.376780+0100 [com.myapp] Removing 1 delivered notifications with identifiers (
"7C1E-73F2"
)
SpringBoard default 14:31:03.377662+0100 [com.myapp] Removing delivered notifications
SpringBoard default 14:31:03.388840+0100 Saving file at /var/mobile/Library/UserNotifications/6E65DC61-BF32-468B-B1A3-CD5B10F811BA/DeliveredNotifications.plist with 0 items
SpringBoard default 14:31:03.399219+0100 kExcludedFromBackupXattrName set on path:
SpringBoard error 14:31:03.400708+0100 No data found at /var/mobile/Library/UserNotifications/6E65DC61-BF32-468B-B1A3-CD5B10F811BA/PendingNotifications.plist
SpringBoard default 14:31:03.400930+0100 [com.myapp] Load 0 pending notification dictionaries
SpringBoard default 14:31:03.401433+0100 [com.myapp] Withdrawing notification 7C1E-73F2
SpringBoard default 14:31:03.402173+0100 BBDataProvider: Withdraw bulletin in section com.myapp publisher bulletin ID MissedCallCategory66071282
SpringBoard default 14:31:03.402455+0100 BBServer: Withdraw bulletin: 366E6C8B-DA60-4054-8CD2-238C3B95F7B3
SpringBoard default 14:31:03.402590+0100 Server has been asked to remove bulletin: 366E6C8B-DA60-4054-8CD2-238C3B95F7B3
SpringBoard default 14:31:03.403140+0100 Sending remove bulletin with transactionID 2, bulletin 366E6C8B-DA60-4054-8CD2-238C3B95F7B3
SpringBoard default 14:31:03.410509+0100 Sending remove bulletin with transactionID 2, bulletin 366E6C8B-DA60-4054-8CD2-238C3B95F7B3
SpringBoard default 14:31:03.411015+0100 Can't send remove bulletin. No transactionID for bulletin 366E6C8B-DA60-4054-8CD2-238C3B95F7B3
SpringBoard default 14:31:03.411335+0100 Sending remove bulletin with transactionID 2, bulletin 366E6C8B-DA60-4054-8CD2-238C3B95F7B3
SpringBoard default 14:31:03.412400+0100 really enqueueing bulletin \
In a bad case there's no logs, system just did nothing.
I've tried to use removeAllDeliveredNotifications it works, but it could remove other notification, which should be present, this not a case here.
There're some suggestions to use delays in code to adjust system's behavior, but it didn't help, still not fully stable.
Is there anything what could be done from the app side to void this issue?