I need to GET multiple root objects with RestKit. JSON from server looks like this:
{
"articles" : [{...}, {...}, {...}, {...}, {...}],
"counters_for_pagination": {"page": 1, "total": 250, "per_page": 5}
}
Do I have to create intermediate class PaginatedResults which will hold NSArray of objects of type Article and NSDictionary with counters?
I'd like to get:
Article objects which I will show in a UITableViewNSDictionary of counters - for pagination.Is RestKit able to return NSDictionary of 2 different objects as a *result or is it always returning an array?
Yes, RestKit can do that. You need:
Article and the other to NSMutableDictionaryarticles and the other counters_for_paginationOnce you have that setup, the mapping result dictionary will contain 2 keys which match the key paths in your response descriptors so that you can access your 2 different types of information.
(in effect, the mapping results is your intermediate class)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With