生成的绑定事件MonoTouch的崩溃 [英] Generated binding events crash MonoTouch
问题描述
我有蓝牙BLE设备与绑定以下绑定:
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
}
和以下委托:
[BaseType(typeof(NSObject))]
[Model]
interface BrspDelegate
{
[Abstract]
[Export("brsp:OpenStatusChanged:"), EventArgs("OpenStatus")]
...other stuff
}
当我挂钩的openstatuschanged生成的事件处理程序,它会立即崩溃的应用程序,我得到任何东西可能是错的没有反馈。我还是一个新手到绑定,所以...
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?
谢谢,
罗吉尔
推荐答案
硬盘没有更多的细节(例如symbolicated崩溃日志),但您的绑定的一部分,说是反转(以及其他可能导致无限递归将崩溃您的应用程序)。
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).
- 您
代表
方法应该有[总结]
属性(在WeakDelegate
);和 - 您
WeakDelegate
方法应该是一个具有[导出]
的属性代表
选择。
- your
Delegate
method should have the[Wrap]
attribute (onWeakDelegate
); and - your
WeakDelegate
method should be the one with the[Export]
attribute on thedelegate
selector.
例如
[Wrap ("WeakDelegate")]
StronglyTypedDelegate Delegate { get; set; }
[Export ("delegate")][NullAllowed]
NSObject WeakDelegate { get; set; }
这篇关于生成的绑定事件MonoTouch的崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!