次のような変換可能なコアデータオブジェクトのプロパティにアクセスしようとしています。
MainObject *localObject = [self.myArray objectAtIndex:indexPath.row];
TransformableObject *actualObject = localObject.transformableObject;
これは正常に機能します。私NSLog
actualObject
と正しいキー/値のペアを取得します:
actualObject:{
property = "Foo";
property2 = "Apple";
}
ただし、IIが次のことを試みる場合:
NSLog (@"property:%@",actualObject.property)
私は得る-[__NSCFDictionary property]: unrecognized selector sent to instance
私は何が間違っているのですか?私のコアデータクラスには、次のものがあります。
@interface MainObject : NSManagedObject
@property (nonatomic, retain) TransformableObjectClass *transformableObject;
編集:これが私がCoreDataでオブジェクトを設定する方法です
MainObject *event = (MainObject *)[NSEntityDescription insertNewObjectForEntityForName:@"MainObject" inManagedObjectContext:[AppDelegateMy managedObjectContext]];
[event setValuesForKeysWithDictionary:[myArrray objectAtIndex:i]];