MonoTouch 绑定到派生的 NSManagedObject
我在 ObjC 中有一些现有代码,我想在 MonoTouch 应用程序中使用它们。我从现有代码创建一个静态库,然后使用绑定从 MonoTouch 应用程序访问和使用它。一切都工作得很好,除了当我尝试绑定到从 NSManagedObject 派生的类型时。由于某种原因,它无法找到该属性。我收到“无法识别的选择器发送到实例”错误。我猜它与 @dynamic 有关,但我不确定,也找不到任何关于为什么这不起作用的文档。
.h
@interface MyNSManagedObject : NSManagedObject
@property (nonatomic, retain) NSString *clientName;
@end
.m
@implementation MyNSManagedObject
@dynamic clientName;
@end
I have some existing code in ObjC that I would like to use in a MonoTouch app. I am creating a static lib from the existing code and then using binding to access and use it from the MonoTouch app. Everything is working great except when I attempt to bind to a type derived from NSManagedObject. For some reason it cannot find the property. I get an "unrecognized selector sent to instance" error. I'm guessing it has something to do with @dynamic, but I'm not sure and couldn't find any documentation regarding why this doesn't work.
.h
@interface MyNSManagedObject : NSManagedObject
@property (nonatomic, retain) NSString *clientName;
@end
.m
@implementation MyNSManagedObject
@dynamic clientName;
@end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论