Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS Emptying Queue of Requests
    primarykey
    data
    text
    <p>When you create/update/delete a record in my app it creates an <code>OutgoingRequest</code> in Core Data. Periodically, the app will get these requests in a queue, and push them all to the server. I do this using a AFHTTPClient post (seen below). The issue I am running into is that it pushes all of these requests up at one time, then the responses come back in no real order. </p> <p>What I need to do is make these requests work 'synchronically' in that <strong>request B should not be posted until request A has finished (success or fail response)</strong>. This is done in the background as well, and should not hang the UI.</p> <pre><code>for(OutgoingRequest *req in queue) { NSURL *reqUrl = [NSURL URLWithString: globals.baseURL]; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:reqUrl]; [httpClient setParameterEncoding:AFJSONParameterEncoding]; NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: req.url, @"viewName", req.json, @"JSON", req.dateAdded.description, @"dateTime", nil]; NSString *path = [NSString stringWithFormat:@"cache/update/?deviceUID=%@&amp;token=%@", [MySingleton getMacAddress], globals.token]; [httpClient postPath:path parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { //handle the repsonse } failure:^(AFHTTPRequestOperation *operation, NSError *error) { }]; } </code></pre> <p>Is there any way to achieve this with my current setup? Or should I be using other means to POST to my server?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload