Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

264
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!