When binding a iOS lib.a for Xamarin, I'm getting the following error:
btouch: The delegate method Device.SomeDeviceDelegate.CaptureComplete needs to take at least one parameter (BI1003)
The bindings were generated Objective Sharpie.
namespace Device
{
// @protocol SomeDeviceDelegate <NSObject>
[Protocol, Model, Preserve]
[BaseType(typeof(NSObject))]
interface SomeDeviceDelegate
{
// @optional -(void)CaptureComplete;
[Export("CaptureComplete")]
void CaptureComplete();
}
// @interface SomeDevice : NSObject
[Protocol, Model, Preserve]
[BaseType(typeof(NSObject), Delegates = new[] { "WeakDelegate" }, Events = new[] { typeof(SomeDeviceDelegate) })]
interface SomeDevice
{
[Wrap("WeakDelegate")]
SomeDeviceDelegate Delegate { get; set; }
// @property (assign, nonatomic) id<SomeDeviceDelegate> delegate;
[NullAllowed, Export("delegate", ArgumentSemantic.Assign)]
SomeDeviceDelegate WeakDelegate { get; set; }
}
}
NB. I've changed the name to SomeDevice
to hide the hardware/device name (NDA).
The compiler is complaining that the // @optional -(void)CaptureComplete;
and respective binding CaptureComplete()
has no parameters and that it needs at least one.
Q: What do I need to do to bind this delegate?
I have tried the Binding Types Reference Guide and have tried applying the
EventArgs
attributeNoDefaultValue
attributeDefaultValueFromArgument
attribute
UPDATE
I misunderstood the NoDefaultValue
and DefaultValueFromArgument
attributes, they are used when the delegate returns a value (e.g. bool
) as the return interferes with the Xamarin wrapping of the event.