RestKit. RKObjectManager and queing

I have a pretty simple question. I have 2 matched requests sent by me close to each other, called by the main topic.

First request: [[RKObjectManager sharedManager] loadObjectsAtResourcePath: @ "SomePathToServer" delegate: self]

Second request:

[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"SomeOTHERpathtoServer" delegate:self]; 

My question is: Are they automatically queued by the object manager?

When I run them now, the first request will cause quite a bit of synchronization with the web service. The second request that I issued in the middle of this connection is not processed / received by RestKit.

If I run the application again, my code found that the synchronization was completed, and now the second request is being processed - the data is received and displayed.

Do I need to manually add my managed requests to the queue?

I did not find anything about this on the network, so if I need to manually queue, I wonder if anyone has an example or directions to the guide. I just found examples of queries for simple queries, and I have no idea how to queue the first and second query - if necessary. Help is much appreciated. Thomas

0
source share
1 answer

RKRequestQueue will do the job. You can add either RKObjectLoader or RKRequest to the queue

Here is an example:

 RKRequestQueue *queue =[[RKRequestQueue alloc] init]; queue.delegate = self; queue.concurrentRequestsLimit = 1; queue.showsNetworkActivityIndicatorWhenBusy= YES; [queue addRequest:[[RKObjectManager sharedManager] objectLoaderWithResourcePath:@"resource" delegate:self]]; [queue addRequest:[RKClient sharedClient] requestWithResourcePath:@"Another Resource "delegate: self]]; [queue start]; 
+2
source

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


All Articles