Omar Himada
Omar Himada

Reputation: 2588

Objective-sharpie ApiDefinition contains overloaded methods?

After some head scratching I finally got objective-sharpie to bind a .framework file successfully, however the ApiDefinition.cs file that it generates contains some irregularities.

    // @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);

So this actually won't compile because Visual Studio aptly points out that the methods have the exact same definition despite having different [Export] attributes. I tried changing it so there is only a single method with multiple [Export] attributes but that isn't allowed either. Not sure what to do here.

Also there is a using statement at the top that I think is trying to point to my Native Reference that I have setup in the Xamarin project in Visual Studio for Mac but it doesn't work (type or namespace could not be found are you missing an assembly reference, etc.)

Any help much appreciated!

Upvotes: 2

Views: 331

Answers (1)

Lucas Zhang
Lucas Zhang

Reputation: 18861

  1. Fixed up warnings by commenting out duplicate implementations in generated code i.e. those that have the same parameters etc.
  2. Removed empty generated interfaces.
  3. Commented out “using xxx(your SDK name)” in ApiDefinition.cs — not 100% sure why this was necessary!

Upvotes: 2

Related Questions