私は3つのエンティティを持っています:
Notification
PlanDate
User
関係:
Notification
と一対一の関係にあるPlanDate
Notification
との対多関係もありますUser
コード:
NSLog (@"Selected Object From Detail ViewDidLoad %@", managedObject);
NSManagedObject *planDateObject = ((PlanDate *)[managedObject valueForKey:@"plandate"]);
NSLog(@"planDateObject %@", planDateObject);
NSString *recipientUserName = [planDateObject valueForKey:@"recipientUserName"];
NSLog(@"recipientUserName: %@", recipientUserName);
ログは次のとおりです。
2013-08-21 12:26:50.349 Time[5018:c07] Selected Object From Detail ViewDidLoad <Notification: 0xa58ee70> (entity: Notification; id: 0xb2a5480 <x-coredata://C0FB76AD-19EB-42BA-981A-F99DD6DCF6C7-5018-0000101A36CFA3D1/Notification/p0B2ABAC1-77F3-4F46-B14D-34652F148B37> ; data: {
appType = 1;
invitationType = PlanDate;
lastmoddate = "2013-08-21 17:42:42 +0000";
"notification_id" = "0B2ABAC1-77F3-4F46-B14D-34652F148B37";
plandate = "0xa1c9350 <x-coredata://C0FB76AD-19EB-42BA-981A-F99DD6DCF6C7-5018-0000101A36CFA3D1/Notification/p1C004B2B-F1DA-4EE0-9FAC-0A89E0DBCDB7>";
users = "<relationship fault: 0xb2aa210 'users'>";
})
2013-08-21 12:26:50.350 Time[5018:c07] planDateObject <Notification: 0xb292800> (entity: Notification; id: 0xa1c9350 <x-coredata://C0FB76AD-19EB-42BA-981A-F99DD6DCF6C7-5018-0000101A36CFA3D1/Notification/p1C004B2B-F1DA-4EE0-9FAC-0A89E0DBCDB7> ; data: <fault>)
2013-08-21 12:26:53.406 Time[5018:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Notification 0xb292800> valueForUndefinedKey:]: the entity Notification is not key value coding-compliant for the key "recipientUserName".'
確かに、値を持つ属性「recipientUserName」があります。同じログを生成する他の属性を試しました。
エラーの理由 属性にアクセスしようとすると、データがエラーとして表示されるのはなぜですか?
編集