我有一个简单的循环:
for(Object_ *obj in not.object)
{
......
Object *objStor = [NSEntityDescription insertNewObjectForEntityForName:@"Object" inManagedObjectContext:context];
.....
}
'Object_'类的接口如下:
@interface Object_ : NSObject
@property (nonatomic, strong) NSNumber * id;
@property (nonatomic, strong) NSString * name;
@property (nonatomic, strong) NSNumber * review_id;
.
.
.
.
@end
'Object'类的接口(由xCode for Core Data Schema创建)如下所示:
@interface Object : NSManagedObject
@property (nonatomic, retain) NSNumber * id;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * rating;
.
.
.
.
@end
我收到错误:
*** NSForwarding: warning: object 0x1a1bb48 of class 'Object' does not implement methodSignatureForSelector: -- trouble ahead
*** NSForwarding: warning: object 0x1a1bb48 of class 'Object' does not implement doesNotRecognizeSelector: -- abort
在线解决方案称将'Object'Class声明为NSObject的子类。但我无法将继承更改为NSObject,因为这会导致Core Data Model失败。
我上面还有另一条线,
Subject *subStor = [NSEntityDescription insertNewObjectForEntityForName:@"Subject" inManagedObjectContext:context];
完美无缺。 导致错误的原因是什么?
答案 0 :(得分:5)
我猜你有一个命名空间冲突。 Obj-C有一个名为Object
的班级,会与班级Object
发生碰撞。
将您的Object
重命名为其他内容。