I'm using AFNetworking
for my app.
I want to create a queue mechanism with different priority for each HTTP request
.
For that - I need to be able to create an HTTP Request
using AFNetowrking
but use it later.
The example for creating an HTTP request is:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@"http://example.com/resources.json" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
This code will send the request immediately. How can I just create the request (method, parameters, url), but use it at a later time?
Turns out you need to create an AFHTTPRequestOperation instead of a manager.
Full article here: http://samwize.com/2012/10/25/simple-get-post-afnetworking/