我在下面使用添加属性映射
RKEntityMapping *entityMapping = [RKEntityMapping mappingForEntityForName:@"Timeline" inManagedObjectStore:managedObjectStore];
[entityMapping addAttributeMappingsFromDictionary:@{@"title": @"title"}];
但是如何添加attachments.title映射?附件是一系列dictionarys。我想访问附件中的标题。
[
{
"category": @"tech",
"attachments": [
{
"title": "Mac Home",
"media": [
{
"sizes": {
"small": [
48,
48
]
},
"type": "image"
}
],
"type": "Group",
}
],
"title": "Joined Group",
}
]
答案 0 :(得分:0)
你不能将数组内容直接映射到同一个对象中,没有办法处理多重性。您需要向模型和关系添加新实体,然后为该实体配置映射以及在2个映射之间配置关系。