我正在尝试访问可转换的核心数据对象的属性,如下所示:
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]];