I have a binding for Bluetooth BLE device with the following binding:
[BaseType (typeof (CBPeripheralDelegate), Delegates=new string [] {"WeakDelegate"},
Events=new Type [] { typeof (BrspDelegate) })]
interface Brsp
{
//@property (nonatomic, weak) id <BrspDelegate> delegate;
[Export ("delegate")]
[NullAllowed]
BrspDelegate Delegate { get; set; }
[Wrap ("WeakDelegate")]
[NullAllowed]
NSObject WeakDelegate { get; set; }
...other stuff
}
And the following delegate:
[BaseType(typeof(NSObject))]
[Model]
interface BrspDelegate
{
[Abstract]
[Export("brsp:OpenStatusChanged:"), EventArgs("OpenStatus")]
...other stuff
}
When I hook up a generated event handler for the openstatuschanged, it instantly crashes the app and I get no feedback whatsoever what could be wrong. I’m still a newbie to binding, so…
I have the feeling somehow I made mistake with “Events = …” part, any ideas?
Thanks,
Rogier
Hard to say without more details (e.g. symbolicated crash log) but part of your bindings are inverted (and that could cause endless recursion that will crash your app).
Delegatemethod should have the[Wrap]attribute (onWeakDelegate); andWeakDelegatemethod should be the one with the[Export]attribute on thedelegateselector.E.g.