Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

261
Vistas
Cómo cancelar un activador de notificación local en Swift

Tengo un activador para mostrar una notificación al usuario:

 let content = UNMutableNotificationContent() content.title = "Title" content.body = "Body" content.sound = UNNotificationSound.default let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 20, repeats: false) let request = UNNotificationRequest(identifier: "TestIdentifier", content: content, trigger: trigger) UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)

¿Hay alguna manera de cancelar ese activador una vez que se ha configurado?

¿Cómo cancelo la notificación antes de timeInterval el intervalo de tiempo y llamo a la notificación?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Puede cancelar o eliminar las notificaciones llamando al:

 let center = UNUserNotificationCenter.current()

Eliminar notificaciones pendientes con identificador dado

 center.removePendingNotificationRequests(withIdentifiers: [“givenIdentifier”])

Y elimine las notificaciones entregadas con el identificador dado

 center.removeDeliveredNotifications(withIdentifiers: [“givenIdentifier”])
over 4 years ago · Santiago Trujillo Denunciar

0

Para construir sobre la respuesta de Mannopson:

Esto elimina todas las notificaciones pendientes ( Swift 5 )

 func cancelNotifications() -> Void { UNUserNotificationCenter.current().removeAllPendingNotificationRequests() }
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda