Match memory balances with multiple root keys

Say, for example, that we have an answer like this:

{
   "authors":[
      {
         "id":"9",
         "name":"Some User",
         "email":"some@email.com"
      }
   ],
   "comments":[
      {
         "id":"5",
         "from":"Some Other User #1",
         "content":"Some comment"
      },
      {
         "id":"12",
         "from":"Some Other User #2",
         "content":"Some other comment"
      }
   ],
   "posts":[
      {
         "id":"1",
         "title":"My new post",
         "links":{
            "author":"9",
            "comments":[
               "5",
               "12"
            ]
         }
      }
   ]
}

In the usual answer author, commentsthey can be nested in a key posts, and RestKit can easily associate relations from the Post class with the associated Author and / or Comment class, so that you can make post.authorand easily get the necessary data. However, if you are not using Core Data and therefore cannot use RKConnectionDescription , the answer shown above does not make it easy to display this path.

: RKObjectMapping w/in-memory, RestKit Post author Comment? post.author, author, post.comments NSSet NSArray Comment.

RestKit, . , , RKObjectMapping RestKit. , , .

+4
1

? , @root, , (.. @"@root.authors.id").

, pull RestKit iOS, / .

+1

Source: https://habr.com/ru/post/1523729/


All Articles