经过一番绞尽脑汁,我终于让 Objective-sharpie 成功绑定(bind)了 .framework
文件,但是它生成的 ApiDefinition.cs
文件包含一些不规则之处。
// @optional -(void)flyerView:(WFKFlyerView * _Nonnull)flyerView gotSingleTap:(id<WFKFlyerViewTapAnnotation> _Nullable)annotation atPoint:(CGPoint)point;
[Export("flyerView:gotSingleTap:atPoint:")]
void FlyerView(WFKFlyerView flyerView, [NullAllowed] WFKFlyerViewTapAnnotation annotation, CGPoint point);
// @optional -(void)flyerView:(WFKFlyerView * _Nonnull)flyerView gotDoubleTap:(id<WFKFlyerViewTapAnnotation> _Nullable)annotation atPoint:(CGPoint)point;
[Export("flyerView:gotDoubleTap:atPoint:")]
void FlyerView(WFKFlyerView flyerView, [NullAllowed] WFKFlyerViewTapAnnotation annotation, CGPoint point);
// @optional -(void)flyerView:(WFKFlyerView * _Nonnull)flyerView gotLongPress:(id<WFKFlyerViewTapAnnotation> _Nullable)annotation atPoint:(CGPoint)point;
[Export("flyerView:gotLongPress:atPoint:")]
void FlyerView(WFKFlyerView flyerView, [NullAllowed] WFKFlyerViewTapAnnotation annotation, CGPoint point);
因此,这实际上不会编译,因为 Visual Studio 恰本地指出,尽管具有不同的 [Export]
属性,但这些方法具有完全相同的定义。我尝试更改它,以便只有一个方法具有多个 [Export]
属性,但这也是不允许的。不知道在这里做什么。
此外,顶部还有一个 using
语句,我认为它试图指向我在 Visual Studio for Mac 的 Xamarin 项目中设置的 Native Reference
但它不起作用(如果您缺少程序集引用等,则无法找到类型或 namespace
)
非常感谢任何帮助!
最佳答案
- 通过注释掉生成代码中的重复实现(即具有相同参数等的实现)来修复警告。
- 删除了生成的空接口(interface)。
- 在 ApiDefinition.cs 中注释掉了“using xxx(您的 SDK 名称)”— 不能 100% 确定为什么需要这样做!
关于xamarin - Objective-sharpie ApiDefinition 包含重载方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52064285/