我需要在子类中覆盖以下DecidePolicy()
但是由于编译器无法解析NIDActionArity1V59
而导致构建错误。 NIDActionArity1V59
在哪里实施,以便我可以应用所需的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);
[...]
}
}
答案 0 :(得分:1)
为什么需要这个属性?您可以像
一样覆盖它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会为您提供正确的重载。所以你不必搜索它们。