这是 Xamarin 生成的绑定中的一个 错误,因为它已正确绑定 except 用于错误应用的 [Abstract] 属性。
注意:我创建了一个 Github 问题:xamarin-macios/issues/3140
由于绑定是正确的,您可以通过创建自己的 VNDetectBarcodesRequest 子类来解决。
VNDetectBarcodesRequest 解决方法
public class FixVNDetectBarcodesRequest : VNDetectBarcodesRequest
{
public FixVNDetectBarcodesRequest(NSObjectFlag t) : base(t) { }
public FixVNDetectBarcodesRequest(IntPtr handle) : base(handle) { }
public FixVNDetectBarcodesRequest(VNRequestCompletionHandler completionHandler) : base(completionHandler) { }
}
用法:
var detectBarcodesRequest = new FixVNDetectBarcodesRequest((request, error) =>
{
//
});
VNDetectBarcodesRequest 绑定不正确:
[TV (11,0), Mac (10,13, onlyOn64: true), iOS (11,0)]
[Abstract]
[DisableDefaultCtor]
[BaseType (typeof (VNImageBasedRequest))]
interface VNDetectBarcodesRequest {
[Export ("initWithCompletionHandler:")]
[DesignatedInitializer]
IntPtr Constructor ([NullAllowed] VNRequestCompletionHandler completionHandler);
[Static]
[Protected]
[Export ("supportedSymbologies", ArgumentSemantic.Copy)]
NSString [] WeakSupportedSymbologies { get; }
[Static]
[Wrap ("VNBarcodeSymbologyExtensions.GetValues (WeakSupportedSymbologies)")]
VNBarcodeSymbology [] SupportedSymbologies { get; }
[Protected]
[Export ("symbologies", ArgumentSemantic.Copy)]
NSString [] WeakSymbologies { get; set; }
}
回复:vision.cs#L156