Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

324
Visualizações
Is there any way to remove delivered notifications upon arrival of a new one?

Roughly during the third quarter of last year, I was able to use UNNotificationServiceExtension to not only decrypt incoming push notification contents (a common use case) but also remove previously delivered notifications every time a new one arrived.

I used UNUserNotificationCenter.current().getDeliveredNotifications to retrieve delivered notifications and then remove those I needed to remove.

However, as the new year rolled up, I suddenly noticed that my app was no longer removing previously delivered notifications from the notification center, despite the code still being present in the service extension and not throwing any errors, and despite the other code in the service extension working just fine.

Upon debugging, I found that UNUserNotificationCenter.current().getDeliveredNotifications now returns an empty array of notifications even when there are several delivered on the lock screen.

And UNUserNotificationCenter.current().removeAllDeliveredNotifications() simply does nothing, so even just using that call, without retrieving or filtering delivered notifications, doesn't remove anything.

Does anyone know if there's still a way to accomplish this?

Or could Apple have prohibited this functionality?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It seems apns-collapse-id APNs request header might be useful here.

  1. It could be used to update former notification content and bring it to the top.

    Multiple notifications with the same collapse identifier are displayed to the user as a single notification.

  2. According to the docs, apns-collapse-id specifies notification identifier (which normally is random). BE could send a new "delete" notification with the given id in the payload to use it in removeDeliveredNotifications(withIdentifiers:) function.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda