1

我有一个简单的循环:

   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

“对象”类的接口(由 xCode 为核心数据模式创建)如下所示:

@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

在线解决方案说将“对象”类声明为 NSObject 的子类。但是我不能将继承更改为 NSObject,因为这会导致核心数据模型失败。

我在它上面还有另一条线,

Subject *subStor = [NSEntityDescription insertNewObjectForEntityForName:@"Subject" inManagedObjectContext:context];

效果很好。是什么导致了错误?

4

1 回答 1

6

我猜你有命名空间冲突。Obj-C 有一个名为的类Object,它会与你的 class 发生冲突Object

将您的重命名Object为其他名称。

于 2013-06-11T12:39:33.603 回答