xamarin - Objective-sharpie ApiDefinition 包含重载方法?

标签 xamarin xamarin.forms xamarin.ios objective-sharpie xamarin.ios-binding

经过一番绞尽脑汁,我终于让 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 )

非常感谢任何帮助!

最佳答案

  1. 通过注释掉生成代码中的重复实现(即具有相同参数等的实现)来修复警告。
  2. 删除了生成的空接口(interface)。
  3. 在 ApiDefinition.cs  中注释掉了“using xxx(您的 SDK 名称)”— 不能 100% 确定为什么需要这样做!

关于xamarin - Objective-sharpie ApiDefinition 包含重载方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52064285/

相关文章:

java - 在 Visual Studio 2015 上运行 xamarin 时出现问题 "Could not locate Java 6 or 7 SDK"

xamarin - 可以在 Xamarin PhotoView 组件中调整初始图像吗?

c# - 可移植类库与库项目

mono - 如何在Mac上的Xamarin Studio中添加本地Nuget包源?

c# - 来自不同类的 UITextField null

xamarin - 如何使用 Realm Xamarin 获取独立/非托管 RealmObject

android - TapGestureRecognizer 对象是否存在与 Taped 事件等效的 UnTapped 事件?

xamarin.forms - System.NotImplementedException : 'This functionality is not implemented in the portable version of this assembly

xaml - Xaml 中的列表<颜色>

ios - 我的 UICollectionView 中没有 ItemSelected 调用?