{"action":"created","issue":{"url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1504","labels_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1504/labels{/name}","comments_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1504/comments","events_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1504/events","html_url":"https://github.com/AFNetworking/AFNetworking/issues/1504","id":21085067,"number":1504,"title":"AFHTTPSessionManager and NSOperation with dependencies","user":{"login":"sendoa","id":776636,"avatar_url":"https://avatars.githubusercontent.com/u/776636?v=3","gravatar_id":"","url":"https://api.github.com/users/sendoa","html_url":"https://github.com/sendoa","followers_url":"https://api.github.com/users/sendoa/followers","following_url":"https://api.github.com/users/sendoa/following{/other_user}","gists_url":"https://api.github.com/users/sendoa/gists{/gist_id}","starred_url":"https://api.github.com/users/sendoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sendoa/subscriptions","organizations_url":"https://api.github.com/users/sendoa/orgs","repos_url":"https://api.github.com/users/sendoa/repos","events_url":"https://api.github.com/users/sendoa/events{/privacy}","received_events_url":"https://api.github.com/users/sendoa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2013-10-16T14:49:03Z","updated_at":"2015-08-05T19:35:08Z","closed_at":"2013-10-25T07:56:44Z","body":"On previous versions of AFNetworking I could make use of `AFHTTPRequestOperation` to create multiple requests, create dependencies between them and enqueue them pretty easily. Example (inside of an `AFHTTPClient` subclass):\r\n\r\n\tNSURLRequest *categoriesRequest = [self requestWithMethod:@\"GET\" path:@\"categories\" parameters:nil];\r\n    AFHTTPRequestOperation *categoriesOperation = [self HTTPRequestOperationWithRequest:categoriesRequest success:^(AFHTTPRequestOperation *operation, id responseObject) {\r\n        NSArray *jsonCategories = responseObject;\r\n        for (NSDictionary *jsonCategory in jsonCategories) {\r\n            SPOCategory *category = [[SPOCategory alloc] initWithDictionary:jsonCategory];\r\n            [self.categories addObject:category];\r\n        }\r\n    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {\r\n        // …\r\n    }];\r\n    \r\n    NSURLRequest *incidencesRequest = [self requestWithMethod:@\"GET\" path:@\"incidences\" parameters:nil];\r\n    AFHTTPRequestOperation *incidencesOperation = [self HTTPRequestOperationWithRequest:incidencesRequest success:^(AFHTTPRequestOperation *operation, id responseObject) {\r\n        NSArray *jsonIncidences = responseObject;\r\n        for (NSDictionary *jsonIncidence in jsonIncidences) {\r\n            SPOIncidence *incidence = [[SPOIncidence alloc] initWithDictionary:jsonIncidence];\r\n            [self.incidences addObject:incidence];\r\n        }\r\n        \r\n        completionBlock(self.incidences, self.categories, nil);\r\n    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {\r\n        // …\r\n    }];\r\n    \r\n    [incidencesOperation addDependency:categoriesOperation];\r\n    \r\n    [self enqueueBatchOfHTTPRequestOperations:@[categoriesOperation, incidencesOperation] progressBlock:^(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations) {\r\n        // Processing…\r\n    } completionBlock:^(NSArray *operations) {\r\n        // Completed\r\n    }];\r\n\r\nI know I can continue to make use of `AFHTTPRequestOperation` but, I'd like to know if there is a similar way to achieve the same thing inside a subclass of `AFHTTPSessionManager`, using `NSURLSession` as the backing library instead of `NSURLConnection`.\r\n\r\nThank you!"},"comment":{"url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/comments/128122692","html_url":"https://github.com/AFNetworking/AFNetworking/issues/1504#issuecomment-128122692","issue_url":"https://api.github.com/repos/AFNetworking/AFNetworking/issues/1504","id":128122692,"user":{"login":"diogot","id":885516,"avatar_url":"https://avatars.githubusercontent.com/u/885516?v=3","gravatar_id":"","url":"https://api.github.com/users/diogot","html_url":"https://github.com/diogot","followers_url":"https://api.github.com/users/diogot/followers","following_url":"https://api.github.com/users/diogot/following{/other_user}","gists_url":"https://api.github.com/users/diogot/gists{/gist_id}","starred_url":"https://api.github.com/users/diogot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diogot/subscriptions","organizations_url":"https://api.github.com/users/diogot/orgs","repos_url":"https://api.github.com/users/diogot/repos","events_url":"https://api.github.com/users/diogot/events{/privacy}","received_events_url":"https://api.github.com/users/diogot/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T19:35:08Z","updated_at":"2015-08-05T19:35:08Z","body":"@mattt there is a branch with the patch that you [mentioned](https://github.com/AFNetworking/AFNetworking/issues/1504#issuecomment-33736042)? \r\nThis will be a huge help."}}