1
我只是試圖解析包含二維數組的JSON對象。RestKit:映射二維數組(集合中的集合)
實施例:
{
"2dimarray": [
[{"key": "val"}, {"key": "val"}],
[{"key": "val"}, {"key": "val"}]
]
}
假設2dimarray[x][y]
內容是僅一種類型的,我添加的映射:
[objectMapping mapKeyPath:@"2dimarray" toRelationship:@"2dimarray" withMapping: myMappingForIncludedObjects];
在日誌RestKit告訴我:
W restkit.object_mapping:RKObjectMappingOperation.m:438 WARNING: Detected a relationship mapping for a collection containing another collection. This is probably not what you want. Consider using a KVC collection operator (such as @unionOfArrays) to flatten your mappable collection.
但實際上這是我想要的。基本上,我假設對象映射器將填充我的Objective-C屬性NSArray* 2dimarray
與NSArray*
,其中包括與myMappingForIncludedObjects
映射的對象。相反,每個陣列都被映射(當然,它失敗)與myMappingForIncludedObjects
。
我在做什麼錯?或者更好:我需要做些什麼來歸檔我預期的行爲?
這[問題](https://github.com/RestKit/RestKit/issues/386)似乎解決這個問題。但是,在給定的例子中,外部數組仍然包含對象,在我的場景中情況並非如此。 – Nicolas 2012-02-29 16:43:53