Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在NSFetchRequest中的propertiesToFetch中包含一个从属性到一个关系的属性_Ios_Objective C_Nsfetchrequest - Fatal编程技术网

Ios 在NSFetchRequest中的propertiesToFetch中包含一个从属性到一个关系的属性

Ios 在NSFetchRequest中的propertiesToFetch中包含一个从属性到一个关系的属性,ios,objective-c,nsfetchrequest,Ios,Objective C,Nsfetchrequest,问题: 为简单起见,我有两个NSManagedObject(A和B),其中B与A有一对一的关系。在我的propertiesToFetch中,使用B作为实体类型,我有许多B属性。不过,这是可行的,我希望还包括从到一关系的属性(例如“名称”) 建议 编辑: //我想在这里添加类似“a.name”的内容 我不知道propertyDescriptionFor:inEntity:方法(它在哪里定义?),但您可以在propertiesToFetch中提供一个字符串数组: fetchR.propertiesT

问题: 为简单起见,我有两个NSManagedObject(A和B),其中B与A有一对一的关系。在我的propertiesToFetch中,使用B作为实体类型,我有许多B属性。不过,这是可行的,我希望还包括从到一关系的属性(例如“名称”)

建议

编辑:

//我想在这里添加类似“a.name”的内容


我不知道
propertyDescriptionFor:inEntity:
方法(它在哪里定义?),但您可以在
propertiesToFetch
中提供一个字符串数组:

fetchR.propertiesToFetch = [NSArray arrayWithObjects:@"name", @"age", @"a.name", nil];

一对一的关系应该“正常运作”

请显示一些代码。马丁:这不仅起作用,还让我知道我不需要属性描述符(我在“propertyDescriptor:inEntity”消息中封装了属性描述符)。
                            nil];
fetchR.propertiesToFetch = [NSArray arrayWithObjects:@"name", @"age", @"a.name", nil];