tauri-apps / tauri-apps/plugins-workspace
Notification Schedule.at() results in crash on iOS [bug]
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
### Describe the bug
Let me know if this is the wrong place--I couldn't find the Issues tab on the notification plugin repo.
When attempting to schedule a Notification on iOS, the app crashes and this happens:
```
Jul 22 10:10:38 Task Manager (DEV)(UserNotifications)[28037] : [------] Adding notification request 6CEA-456B to destinations: Default
Jul 22 10:10:38 Task Manager (DEV)(CoreFoundation)[28037] : *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSXPCEncoder _checkObject:]: This coder only encodes objects that adopt NSSecureCoding (object is of class '__SwiftValue').'
*** First throw call stack:
(0x1a2bf8f20 0x19aa8a018 0x1a1a2adf4 0x1a1a29ba4 0x1a1a29324 0x1a1a48780 0x1a1a29574 0x1ca838408 0x1a1a29574 0x1ca82996c 0x1a1a29574 0x1a1a4b5ac 0x1a1a4b3a8 0x1a1a83c4c 0x1a1afc15c 0x1a1afbdec 0x1ca83d5d8 0x1aaa9ddd4 0x1aaaad2c4 0x1ca83d45c 0x1ca83b7c0 0x1016041c4 0x1016090e4 0x101609448 0x1015e6ce4 0x1015e8a48 0x1a14e8068 0x1015e64d4 0x1015e6d30 0x1aaa9c13c 0x1aaa9ddd4 0x1aaaa5400 0x1aaaa5f30 0x1aaab0cb4 0x1aaab0528 0x1ffa4f934 0x1ffa4c0cc)
```
Xcode tells me the error is being thrown on [line 113 of NotificationPlugin.swift](https://github.com/tauri-apps/tauri-plugin-notification/blob/426202c8fcb173b0e2c8ee3ff2f94dac7287d8f3/ios/Sources/NotificationPlugin.swift#L113C2-L113C43)
Thanks!
### Reproduction
```typescript
import { isPermissionGranted, requestPermission, Schedule, sendNotification } from '@tauri-apps/plugin-notification'
let permissionGranted = await isPermissionGranted();
if (!permissionGranted) {
const permission = await requestPermission();
permissionGranted = permission === 'granted';
}
if (permissionGranted) {
sendNotification({
title: "test",
body: "test",
schedule: Schedule.at(new Date())
})
}
```
I've tried later dates, too, of course.
### Expected behavior
_No response_
### Full `tauri info` output
```text
[✔] Environment
- OS: Mac OS 14.1.0 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
✔ rustup: 1.24.3 (2021-05-31)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 20.13.1
- npm: 10.5.2
[-] Packages
- tauri [RUST]: 2.0.0-beta.24
- tauri-build [RUST]: 2.0.0-beta.19
- wry [RUST]: 0.41.0
- tao [RUST]: 0.28.1
- @tauri-apps/api [NPM]: 2.0.0-beta.13
- @tauri-apps/cli [NPM]: 2.0.0-beta.20
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ["../dist","../src/styles/themes","../src/tabs","../src/fonts"]
- devUrl: http://localhost:1420/
- bundler: Vite
[-] iOS
- Developer Teams: -----
```
### Stack trace
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.