gpt4 book ai didi

ios - Xamarin iOS Webkit : How do I resolve NIDActionArity1V59?

转载 作者:行者123 更新时间:2023-11-29 01:04:35 24 4
gpt4 key购买 nike

我需要在子类中重写以下 DecidePolicy(),但我遇到构建错误,因为编译器无法解析 NIDActionArity1V59NIDActionArity1V59 在哪里实现,以便我可以应用所需的 using 语句,

using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Foundation;
using ObjCRuntime;

namespace WebKit
{
//
// Summary:
// Delegate object for WebKit.WKNavigation objects, provides methods relating to
// navigation and load policies.
[Introduced(PlatformName.MacOSX, 10, 10, PlatformArchitecture.Arch64, null)]
[Introduced(PlatformName.iOS, 8, 0, PlatformArchitecture.None, null)]
[Model]
[Protocol]
[Register("WKNavigationDelegate", false)]
public class WKNavigationDelegate : NSObject, IWKNavigationDelegate, INativeObject, IDisposable
{
[...]
//
// Summary:
// Assigns an action to be taken after the specified navigationAction has been either
// canceled or allowed.
[CompilerGenerated]
[Export("webView:decidePolicyForNavigationAction:decisionHandler:")]
public virtual void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, [BlockProxy(typeof(NIDActionArity1V59))] Action<WKNavigationActionPolicy> decisionHandler);


[...]
}
}

最佳答案

为什么需要这个属性?您可以像这样简单地覆盖它

public class MyNavigationDelegate : WKNavigationDelegate
{
public override void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, Action<WKNavigationActionPolicy> decisionHandler)
{
// do some stuff
}
}

据我所知,BlockProxy 属性仅在内部使用。 https://developer.xamarin.com/api/type/ObjCRuntime.BlockProxyAttribute/

如果你看一下 documentation您不会看到单个属性,因为它们不是函数签名的一部分。所以我猜,你对反编译源代码看得太深了,让自己有点困惑 ;)

提示:当您键入 override 后跟一个空格时,Visual Studio 会为您提供正确的重载。所以您不必搜索它们。

enter image description here

关于ios - Xamarin iOS Webkit : How do I resolve NIDActionArity1V59?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36557260/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com