I have a IBAction which is called via a button in my iPad App.
The IBaction Calls then three different methods which initiate a RestKit Request.
What would be the best way to check of for all three requests the objects where retrieved?
The goal is to show an activityIndicator with the first request and stop/hide the activityIndicator with the retrieval of objects for all three requests.
I’m new to RestKit, so please forgive me if this is a too simple question. I tried to find a solution by myself with the help of the RestKit API – Documentation.
I suppose you use asynchronous requests. One simple solution can be a check in your
RKObjectLoderDelegate‘s- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objectsmethod whether all of your data is already loaded.When initiating RestKit requests, you can add a ‘tag’ (called
userDatain RestKit) to a request and retrieve that tag later in the delegate callbacks.For example, you can implement the following logic:
When you create your requests, add a specific user data to each one:
and check the tags in
didLoadObjects:Don’t forget to handle error situations when loading the requests.
Alternatively, if this approach will not fit your scenario – you can add and manage requests in a separate queue & track the progress. If you’ll need more info on the second option just let me know.