-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
Hello,
I'm trying to call a function in ObjC that takes a callback function, and I'm hoping to have that call back to a rust function. The function I'm trying to call is this one: https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript?language=objc.
When I pass null to the callback function, it works:
let callback_pointer = std::ptr::null::<*const std::ffi::c_void>(); // *const *const core:ffi::c_void
let _: id = objc::msg_send![controller, evaluateJavaScript:javascript_string completionHandler:callback_pointer];
I tried this:
> struct NSError(id);
> extern fn javascript_callback_macos(value: id, error: NSError) {
> println!("javascript_callback_macos");
> }
> ...
> let _: id = objc::msg_send![controller, evaluateJavaScript:javascript_string completionHandler:javascript_callback_macos as extern fn(id, NSError)];
but it crashes without an error message
Metadata
Metadata
Assignees
Labels
No labels