我想使用新的iOS 11视觉API和C# / Xamarin来检测条形码。
然而,VNDetectBarcodesRequest类的xamarin是抽象的。其他请求类型(例如,VNDetectRectanglesRequest )不是。是框架的这一部分没有在Xamarin中实现,还是我在这里遗漏了什么?
基本上,我想调整矩形检测样本(https://developer.xamarin.com/samples/monotouch/ios11/VisionRectangles/)来检测QR码。
非常感谢!
发布于 2017-12-28 09:24:39
更新:此错误已修复,请检查扎马林-马西奥斯/问题/3140
这是Xamarin生成的绑定中的bug,因为它正确地绑定了,但对于应用不当的[Abstract]属性,除外。
注意:我创建了一个Github问题:扎马林-马西奥斯/问题/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; }
}https://stackoverflow.com/questions/48004305
复制相似问题