我试图访问一个像这样的变形芯数据对象的属性:核心数据可转换属性
MainObject *localObject = [self.myArray objectAtIndex:indexPath.row];
TransformableObject *actualObject = localObject.transformableObject;
这工作得很好。我NSLog
actualObject
并得到正确的键/值对:
actualObject:{
property = "Foo";
property2 = "Apple";
}
然而,当我我尝试:
NSLog (@"property:%@",actualObject.property)
我得到-[__NSCFDictionary property]: unrecognized selector sent to instance
我在做什么错?在我的核心数据类,我有:
@interface MainObject : NSManagedObject
@property (nonatomic, retain) TransformableObjectClass *transformableObject;
编辑: 下面是如何设置的对象在核心数据
MainObject *event = (MainObject *)[NSEntityDescription insertNewObjectForEntityForName:@"MainObject" inManagedObjectContext:[AppDelegateMy managedObjectContext]];
[event setValuesForKeysWithDictionary:[myArrray objectAtIndex:i]];
最初如何设置'localObject.transformableObject'的值?在您的模型中如何配置属性? 'actualObject'显然是一个'NSDictionary',但是你没有给我们足够的信息来推论为什么。 –
TransformableObjectClass是另一个Core Data NSManagedObject类。 – Eric
可能是这样,但错误显示实际分配给该属性的实例是'NSDictionary'的实例。那么,它是如何到达那里的? –