Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8664489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:15:06+00:00 2026-06-12T17:15:06+00:00

I am using RestKit 0.10.3 to ask for new messages from my custom web

  • 0

I am using RestKit 0.10.3 to ask for new messages from my custom web service.

I have all objects and mappings working properly but I am facing an issue about the number of objects returned by a single request made to the server (a RKObjectLoader instance).

Suppose that I have a MessengerConversation object which has a conversationID property value equal to 1 and no MessengerMessage inside of it (that is an empty conversation).

Initially I had requested for five new messages from my custom web service:

GET /messenger/conversations/1/messages/?maxmsgcount=5

and it returned a JSON payload like:

{
  "messages": [
    {
      "content": "A new message.",
      "messageid": 10
    },
    {
      "content": "A new message.",
      "messageid": 9
    },
    {
      "content": "A new message.",
      "messageid": 8
    },
    {
      "content": "A new message.",
      "messageid": 7
    },
    {
      "content": "A new message.",
      "messageid": 6
    }
  ]
}

At the moment, everything worked fine and the results could be accessed by the returned objects from a RKObjectLoader callback:

[objects count] == 5

But after requesting for older five messages to the same API, a not desired result is appearing:

GET /messenger/conversations/1/messages/?maxmsgcount=5&msgsbeforeid=6

returning a JSON payload like:

{
  "messages": [
    {
      "content": "A new message.",
      "messageid": 5
    },
    {
      "content": "A new message.",
      "messageid": 4
    },
    {
      "content": "A new message.",
      "messageid": 3
    },
    {
      "content": "A new message.",
      "messageid": 2
    },
    {
      "content": "A new message.",
      "messageid": 1
    }
  ]
}

The problem is with the [objects count] which is now equal to 10 instead of 5 as the number of returned messages into the received JSON payload.

This way, it is impossible to track the biggest and the smallest message IDs from the latest returned JSON payload because the objects array contains all messages inside of the referenced conversation.

Printing description of objects:
<__NSArrayM 0xa720a40>(
<MessengerMessage: 0xa721560> (entity: MessengerMessage; id: 0xa7021c0 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p1> ; data: <fault>),
<MessengerMessage: 0x13360490> (entity: MessengerMessage; id: 0x133605a0 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p2> ; data: <fault>),
<MessengerMessage: 0x13360510> (entity: MessengerMessage; id: 0xa7023a0 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p3> ; data: <fault>),
<MessengerMessage: 0x13360550> (entity: MessengerMessage; id: 0xa7022b0 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p4> ; data: <fault>),
<MessengerMessage: 0xa720290> (entity: MessengerMessage; id: 0xa702080 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p5> ; data: <fault>),
<MessengerMessage: 0xa71ca40> (entity: MessengerMessage; id: 0x13360cf0 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p6> ; data: <fault>),
<MessengerMessage: 0x12f96c40> (entity: MessengerMessage; id: 0xa7023f0 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p7> ; data: <fault>),
<MessengerMessage: 0x133603c0> (entity: MessengerMessage; id: 0x13360b10 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p8> ; data: <fault>),
<MessengerMessage: 0x13360380> (entity: MessengerMessage; id: 0x13360c00 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p9> ; data: <fault>),
<MessengerMessage: 0xa720700> (entity: MessengerMessage; id: 0x13360a20 <x-coredata://569C8DF6-D912-4DFF-B5A2-C462F0355B3F/MessengerMessage/p10> ; data: <fault>)
)

I am configuring all commented requests with the next settings due to mapping issues:

[objectManager loadObjectsAtResourcePath:resourcePath usingBlock:^(RKObjectLoader *loader) {
    loader.targetObject = [MessengerConversation findByPrimaryKey:query.conversationID];
    ...
}];

Is it possible to make the RKObjectLoader to return only the objects mapped from latest received JSON payload?

I think I am missing something but I can’t figure it out.

Thanks in advance.

Piva

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:15:07+00:00Added an answer on June 12, 2026 at 5:15 pm

    I could fix this problem by just updating the way I was inserting loaded MessengerMessage instances inside of MessengerConversation objects.

    Instead of using the RKObjectLoader ‘targetObject’ property to define from which conversation loaded message were I started using the RKObjectLoaderDelegate ‘objectLoader:willMapData:’ method to manually insert the conversationid key into each loaded message.

    Then I just setup differently the MessengerMessage mapping into my custom mapping provider to handle next commands:

    [objectMappingMessage mapKeyPath:@"conversationid" toAttribute:@"conversationID"];
    [objectMappingMessage hasOne:@"conversation_" withMapping:objectMappingConversation];
    [objectMappingMessage connectRelationship:@"conversation_" withObjectForPrimaryKeyAttribute:@"conversationID"];
    

    Only loaded messages (from a current JSON payload) are now being returned into the objects array from a RKObjectLoader callback.

    Also, thanks @blakewatters by your efforts answering some questions of mine on IRC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using RestKit to grab objects from my RoR service and using CoreData to
I am successfully retrieving JSON data from a web service with GET using Restkit's
Using RestKit 0.10.1, I have objects served similar to this json format: {objects: [
When logging out or sending (to a web service using RestKit) specifically the subThoroughfare
I'm using Restkit to consume a web service that sends back XML. Some of
I am using RestKit in my app for all web/network calls. On launch, in
Im using restkit and push notifications and I have also built the interface, so
I have been trying to post using RestKit after I have successfully used it
I have an app using RestKit successfully. I am building an IAP in the
I have a small app using RestKit with a Sinatra-backed server. When I post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.