tauri: [bug] My program crashed when I called @tauri-apps/api/app setTheme.
Describe the bug
My program crashed when I called setTheme. Macbook M2 Pro, MacOS Sonoma 14.5 (23F79), tauri 2.5.1
import { setTheme } from '@tauri-apps/api/app';
function switchTheme() {
setTheme('dark');
}
permission declared in tauri.conf.json
"permissions": {
"core:app:default",
"core:app:allow-set-app-theme",
}
Reproduction
No response
Expected behavior
No response
Full tauri info output
2025-05-14 18:16:52.927170+0800 qino-feed-client[53816:11363262] [ProcessSuspension] 0x116024900 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=54376, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
2025-05-14 18:16:52.929994+0800 qino-feed-client[53816:11363262] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
2025-05-14 18:16:52.930023+0800 qino-feed-client[53816:11363262] [ProcessSuspension] 0x116024960 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=54376, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
2025-05-14 18:16:59.289129+0800 qino-feed-client[53816:11360392] [miscellany] CLIENT ERROR: TUINSRemoteViewController does not override -viewServiceDidTerminateWithError: and thus cannot react to catastrophic errors beyond logging them
Exception: EXC_BREAKPOINT (code=1, subcode=0x19ae7e4f4)
Exception: EXC_BREAKPOINT (code=1, subcode=0x19ae7e4f4)
Exception: EXC_BREAKPOINT (code=1, subcode=0x19ae7e4f4)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (7 by maintainers)
Thanks, I’ve verified it, and now it’s working correctly. It can switch the changes of the application theme.
But there has another issue. First, after the theme changes, the appWindow.onThemeChanged in the Tauri API fails to trigger the listening callback. (The standard Web API’s MediaQuery changed event works, so I’m using this method as a substitute for now.)