[notification] iOS: toActiveNotification force-unwraps notificationsMap, crashing on any action tap after the app was terminated
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
Direzione di ricerca
Inizia in plugins/notification/ios/Sources/NotificationHandler.swift, in corrispondenza di toActiveNotification, quindi esamina i suoi chiamanti didReceive(response:) e willPresent(notification:). Verifica che la richiesta di notifica fornisca i campi fondamentali quando notificationsMap è vuoto ed esegui i test iOS del plugin delle notifiche, se disponibili. Il lavoro è completato quando le notifiche pianificate aperte dopo la terminazione dell’app non causano più arresti anomali e i suoni o gli allegati memorizzati rimangono disponibili quando presenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
toActiveNotification force-unwraps an in-memory dictionary that is empty in the exact case a scheduled notification is designed for:
func toActiveNotification(_ request: UNNotificationRequest) -> ActiveNotification {
let notificationRequest = notificationsMap[request.identifier]! // 💥
notificationsMap is populated only by saveNotification, at schedule time, in the current process. A notification scheduled hours earlier and delivered after iOS has terminated the app finds it empty, and the force-unwrap traps.
That is the normal case for any scheduled reminder — the whole point of Schedule.at is that it survives the app not running — and the only case for an action tap forwarded from a paired Apple Watch.
Both callers reach it:
didReceive(response:)— user taps the notification or one of its action buttonswillPresent(notification:)— notification arrives while the app is foreground
Reproduction
sendNotificationwithschedule: Schedule.at(...)a few minutes out- Force-quit the app (or let iOS terminate it)
- When the notification fires, tap it
The app relaunches and immediately crashes instead of delivering the action.
Suggested fix
Nothing the caller needs actually requires the map. id, title, body and actionTypeId all come from the UNNotificationRequest, which is always present; only sound and attachments came from the map, and both degrade cleanly:
let stored = notificationsMap[request.identifier]
return ActiveNotification(
id: Int(request.identifier) ?? -1,
title: request.content.title,
body: request.content.body,
sound: stored?.sound ?? "",
actionTypeId: request.content.categoryIdentifier,
attachments: stored?.attachments
)
Behaviour is unchanged whenever the entry exists. The same file already uses the safe if let form a few lines earlier in willPresent, so this reads as an oversight rather than a deliberate invariant.
Full tauri info output
Plugin version 2.3.3; also present on v2 HEAD as of today. Reproduced on an iOS 26 simulator with tauri-cli 2.9.5.
Stack trace
Crash on relaunch in toActiveNotification, via didReceive(response:).
Additional context
I have been running this as a vendored patch for a few weeks and it has been stable. Happy to open a PR if useful.
- Lingua principale
- Rust
- Stelle
- 1.8k
- Fork
- 637
- Merge medio
- 5g 3h
- PR unite (30g)
- 36
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tauri-apps/plugins-workspace
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
tauri-apps/plugins-workspace#3780 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tauri-apps/plugins-workspace#3770 ·
I maintainer di solito rispondono entro 3 giorni
-
[notification] init script fires IPC on about:blank → 500 'Origin header is not a valid URL' on Linux (WebKitGTK)Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaplatform: linux plugin: notification type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
tauri-apps/plugins-workspace#3562 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
tauri-apps/plugins-workspace#3543 ·
I maintainer di solito rispondono entro 3 giorni
-
[bug][notification] Windows: init script always sets `window.Notification.permission` to `"denied"` at startupForse già presa @Legend-Master l’ha presa 86 giorni fa. Apertaplatform: windows plugin: notification type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tauri-apps/plugins-workspace#3512 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di tauri-apps/plugins-workspace
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
servo/rust-smallvec#877 ·
-
A-documentation S-needs-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
Quantinuum/hugr#3344 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NVIDIA/spark-local-inference#268 ·