ios - AFNetworking enqueRequestOperations triggers completion before all AFJSONRequestOperation completions are called -


afhttpclient *client = [[afhttpclient alloc] initwithbaseurl:[nsurl urlwithstring:@"http://twitter.com"]];  nsurl *url = [nsurl urlwithstring:@"https://alpha-api.app.net/stream/0/posts/stream/global"]; nsurlrequest *r = [nsurlrequest requestwithurl:url];  afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest:r success:^(nsurlrequest *request, nshttpurlresponse *response, id json) {     nslog(@"app.net global stream: %@", json); } failure:nil]; afjsonrequestoperation *operation1 = [afjsonrequestoperation jsonrequestoperationwithrequest:r success:^(nsurlrequest *request, nshttpurlresponse *response, id json) {     nslog(@"app.net global stream: %@", json); } failure:nil];  [client enqueuebatchofhttprequestoperations:@[operation, operation1] progressblock:^(nsuinteger numberoffinishedoperations, nsuinteger totalnumberofoperations) {  } completionblock:^(nsarray *operations) {     nslog(@"%@", operations); }]; 

enqueuebatchofhttprequestoperations completion triggered before operation , operation1 blocks.

did read https://github.com/afnetworking/afnetworking/issues/362 , tried possible fix dispatch_group it's still not work.

change code use afhttprequestoperation instead of afjsonrequestoperation , parse json manually using nsjsonserialization , find queue completion block fires after operations have completed required.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -