【问题标题】:RestKit map object with url as attribute以 url 为属性的 RestKit 映射对象
【发布时间】:2012-01-31 22:25:34
【问题描述】:

我有以下 JSON,我喜欢在 restkit 中映射。

{
 "objects": [
     {"name": "John Doe",
      "contacts": [
         "/url/to/contact/1/",
      ]
     }
}

是否可以在 RestKit 中直接映射它,结合 Core Data,在这种情况下,如果 id 为 1 的联系人存在,请不要按照 url 来检索联系人。 完成这项工作的最佳方法是什么?

【问题讨论】:

  • 这不是有效的 JSON。
  • 它是用 django-tastypie 制作的
  • swoei,contacts的值是一个字符串列表。看看你能不能把它变成一个字典列表。然后,跟随these instructions做映射。

标签: ios json restkit


【解决方案1】:

是的,你可以,但你应该脱水你的联系人,以便你得到 id 而不是 url,restkit 映射关系与 id 而不是 url。然后关注这个帖子:RestKit Object Mapping Relationships without KVC

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多