【发布时间】:2015-04-26 13:00:19
【问题描述】:
我对 Rest Kit 有疑问,但我还没有找到答案。 基本上我有 JSON: http://pastebin.com/3UBXUy3A 和映射:
let artistMapping = RKObjectMapping(forClass: Artist.self)
artistMapping.addAttributeMappingsFromDictionary(["name": "name", "playcount": "playCount"])
let responseDescriptor = RKResponseDescriptor(mapping: artistMapping, method: RKRequestMethod.GET, pathPattern: "/2.0", keyPath: "topartists.artist", statusCodes: NSIndexSet(index: 200))
我想要做的是以小图像 url 为例,并将其映射到我的 Artist 类 url 属性。
我在 GSON 编写自定义反序列化器时做了类似的事情,但在这里我还没有找到如何去做。我不想创建另一个类 ImageDescription 并在我的 Artist 类中创建它的数组。 那么该怎么做呢?
【问题讨论】: