-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WKUIDelegate runJavaScriptTextInputPanelWithPrompt has incorrect nullability #15728
Labels
Milestone
Comments
I assume this would be covered by your nullability work, have you looked at this framework yet @tj-devel709 ? |
this bug come from far with xamarin.. please solve this... |
Any news on this? It looks like with MAUI and .NET v8 (at least) the problem is still present. |
Can you try using this as a workaround, it's a custom implementation of the using CoreFoundation;
using ObjCRuntime;
using WebKit;
#nullable enable
class MyWKUIDelegate : WKUIDelegate {
// Custom implementation due to https://github.com/xamarin/xamarin-macios/issues/15728.
[Export ("webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:")]
void RunJavaScriptTextInputPanel (WKWebView webView, string prompt, string? defaultText, WKFrameInfo frame, IntPtr blockCompletionHandler)
{
var completionHandler = NIDActionArity1V72.Create (blockCompletionHandler);
// ...
if (completionHandler is not null)
completionHandler (null);
}
sealed class NIDActionArity1V72 : TrampolineBlockBase {
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::System.Action<string?>))]
unsafe delegate void DActionArity1V72 (IntPtr block, NativeHandle obj);
DActionArity1V72 invoker;
public unsafe NIDActionArity1V72 (BlockLiteral *block) : base (block)
{
invoker = block->GetDelegateForBlock<DActionArity1V72> ();
}
[Preserve (Conditional=true)]
public unsafe static global::System.Action<string?>? Create (IntPtr block)
{
if (block == IntPtr.Zero)
return null;
var del = (global::System.Action<string?>) GetExistingManagedDelegate (block);
return del ?? new NIDActionArity1V72 ((BlockLiteral *) block).Invoke;
}
unsafe void Invoke (string? obj)
{
var nsobj = CFString.CreateNative (obj);
invoker (BlockPointer, nsobj);
CFString.ReleaseNative (nsobj);
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The API in objc (and also in the ms docs) indicate that values can be null:
https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview?language=objc
The text was updated successfully, but these errors were encountered: