两个实体:
- 通知
- 用户
Notification
relationship
与名为“”的用户一对一senderUser
。在 NSManagedObject 文件中Notification
,senderUser
看起来像这样
@property (nonatomic, retain) User *senderUser;
发件人用户有一个名为的 NSString 属性username
访问该属性的正确语法是什么?我尝试了以下方法,但出现错误:
Notification *managedObject = [array objectAtIndex:indexPath.row];
NSString *senderUN = [managedObject valueForKey:@"senderUser.username"];
错误:
`*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Notification 0xbc4ad80> valueForUndefinedKey:]: the entity Notification is not key value coding-compliant for the key "senderUser.username"`.'