c2r0b / tauri-plugin-context-menu

Native Context Menu in Tauri v1
https://crates.io/crates/tauri-plugin-context-menu
MIT License
133 stars 7 forks source link

Crashed with 'Class should exist' error on macOS M1 #24

Closed jiakuan closed 5 months ago

jiakuan commented 5 months ago

I tried with the latest version 0.7.1 on macOS 14.2.1 (23C71) (Apple M1), but when tauriApi.invoke was called, the app crashed and got the following error:

thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-plugin-context-menu-0.7.1/src/macos.rs:205:60:
Class should exist
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_display
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:197:5
   3: core::panicking::panic_str
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:172:5
   4: core::option::expect_failed
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/option.rs:1995:5
   5: core::option::Option<T>::expect
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/option.rs:896:21
   6: tauri_plugin_context_menu::os::create_context_menu
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-plugin-context-menu-0.7.1/src/macos.rs:205:13
   7: tauri_plugin_context_menu::os::show_context_menu::{{closure}}
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-plugin-context-menu-0.7.1/src/macos.rs:221:20
   8: dispatch::context_and_function::work_execute_closure
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dispatch-0.2.0/src/lib.rs:94:9
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <() as objc::message::MessageArguments>::invoke
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/message/mod.rs:128:17
  22: objc::message::platform::send_unverified::{{closure}}
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/message/apple/mod.rs:27:9
  23: objc_exception::try::{{closure}}
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/src/lib.rs:68:31
  24: objc_exception::try_no_ret::try_objc_execute_closure
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/src/lib.rs:34:9
  25: RustObjCExceptionTryCatch
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/extern/exception.m:10:9
  26: objc_exception::try_no_ret
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/src/lib.rs:44:19
  27: objc_exception::try
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/src/lib.rs:67:9
  28: objc::exception::try
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/exception.rs:8:5
  29: objc::message::platform::send_unverified
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/message/apple/mod.rs:26:5
  30: objc::message::send_message
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/message/mod.rs:178:5
  31: tao::platform_impl::platform::event_loop::EventLoop<T>::run_return
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.16.9/src/platform_impl/macos/event_loop.rs:193:16
  32: tao::platform_impl::platform::event_loop::EventLoop<T>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.16.9/src/platform_impl/macos/event_loop.rs:160:21
  33: tao::event_loop::EventLoop<T>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.16.9/src/event_loop.rs:179:5
  34: <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-0.14.8/src/lib.rs:2299:5
  35: tauri::app::App<R>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-1.6.7/src/app.rs:868:5
  36: tauri::app::Builder<R>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-1.6.7/src/app.rs:1723:5
  37: testapp_lib::run
             at ./src/lib.rs:81:3
  38: testapp_app::main
             at ./src/main.rs:7:3
  39: core::ops::function::FnOnce::call_once
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
libc++abi: terminating due to uncaught foreign exception

Any ideas?

jiakuan commented 5 months ago

I've got it fixed, seems not an issue. Thanks!