ver recuperar pantalla notificaciones historial funciona como centro borradas bloqueada ios swift notifications calendar

ios - pantalla - recuperar notificaciones iphone



Activador de notificaciones de iOS: quincenal y/o trimestral (1)

No vi ninguna opción directa para activar la notificación quincenal. Sugerencia de mi parte.

1) ¿Es posible recibir una notificación que se repite cada dos semanas?

Estoy proponiendo dos opciones:

  1. ¿Podemos usar UNTimeIntervalNotificationTrigger para repetir la notificación con un intervalo de tiempo de dos semanas? Ejemplo a continuación

    let timeInterValFor2Weeks = 1190507.790425003 let intervalTrigger = UNTimeIntervalNotificationTrigger(timeInterval: timeInterValFor2Weeks, repeats: true)//"Jan 3, 2017, 5:24 PM" intervalTrigger.nextTriggerDate() //"Jan 17, 2017, 12:05 PM"

  2. Programe dos disparadores UNCalendarNotificationTrigger , que se deben activar primero y tercer día del mes. Por ejemplo, debe enviar una notificación el primer domingo y el tercer domingo de un mes.

    var fortnightPart1 = DateComponents() fortnightPart1.weekday = 1 //(Day..here Sunday) fortnightPart1.weekdayOrdinal = 2 //= n == (nth Day in the month...here 2nd Sunday in every month month) fortnightPart1.hour = 12 let fortnightTrigger = UNCalendarNotificationTrigger(dateMatching: fortnightPart1, repeats: true) fortnightPart1.nextTriggerDate()

2) ¿Cómo obtenemos un disparador por una vez por trimestre?

Si no hay una opción directa disponible, sugiero la misma solución que la anterior.

Parece que no puedo encontrar ninguna documentación de Apple para este escenario exacto, y he intentado varias formas de hacerlo y sigo llegando vacío.

Me gustaría programar una notificación repetitiva ( iOS 10+ para UNCalendarNotificationTrigger o equivalente).
Estas son notificaciones locales y no notificaciones push.

Mi meta:

Programar notificaciones que se repiten:

  • una vez cada quince días (por ejemplo, cada segundo martes)
  • una vez por trimestre (p. ej., 1 de cada 3 meses )

Mi enfoque actual:

Estos desencadenantes funcionan bien y son fáciles de implementar (ejecutar el código en un campo de juego Swift).

// Every day at 12pm var daily = DateComponents() daily.hour = 12 let dailyTrigger = UNCalendarNotificationTrigger(dateMatching: daily, repeats: true) dailyTrigger.nextTriggerDate() // "Jan 4, 2017, 12:00 PM" // Every Tuesday at 12pm var weekly = DateComponents() weekly.hour = 12 weekly.weekday = 3 let weeklyTrigger = UNCalendarNotificationTrigger(dateMatching: weekly, repeats: true) weeklyTrigger.nextTriggerDate() // "Jan 10, 2017, 12:00 PM" // The 1st of every month at 12pm var monthly = DateComponents() monthly.hour = 12 monthly.day = 1 let monthlyTrigger = UNCalendarNotificationTrigger(dateMatching: monthly, repeats: true) monthlyTrigger.nextTriggerDate() // "Feb 1, 2017, 12:00 PM" // Every 1st of February at 12pm var yearly = DateComponents() yearly.hour = 12 yearly.day = 1 yearly.month = 2 let yearlyTrigger = UNCalendarNotificationTrigger(dateMatching: yearly, repeats: true) yearlyTrigger.nextTriggerDate() // "Feb 1, 2017, 12:00 PM"

Pero...

Parece que no puedo obtener un disparador fortnightly o quarterly para funcionar correctamente.

// Every second Tuesday at 12pm // ... There is no "date.fortnight", is this possible? // The 1st of every quarter at 12pm var quarterly = DateComponents() quarterly.hour = 12 quarterly.day = 4 // Values: 1, 2, 3 or 4 all produce the same "nextTriggerDate" - why? quarterly.quarter = 4 let quarterlyTrigger = UNCalendarNotificationTrigger(dateMatching: quarterly, repeats: true) quarterlyTrigger.nextTriggerDate()

Entonces, para ser claro, mis preguntas son:

  1. ¿Es posible recibir una notificación que se repite cada quince días?
  2. ¿Cómo obtenemos un disparador por una vez por trimestre?

Dado que DateComponents() tiene un quarter unidad, supongo que es posible un desencadenante quarterly . Sin embargo, para el recordatorio quincenal, ni siquiera estoy seguro de si esto es posible ...

¡Cualquier idea sería apreciada!