I am trying to produce a request using afnetworking in objective c, however, it seems like the hardware that I am trying to connect to only applies requests when the parameters of the request are in a specific order. So I am wondering if there is a way to make the request so that the parameters are in a specific order. (As just doing it normally seems to jumble the sequence of the params up)
Here's my code:
NSDictionary *params = @{
@"param1" : @"bla",
@"param2" : @"bla2",
@"param3" : @"bla3"
};
[requestManager GET:@"somewhere" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
DLog(@"Success!");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
DLog(@"Fail: %@", error);
}];
It actually goes to success every time, its just that the request I had applied would be practically ignored.
The actual request body becomes something like "param3=bla3¶m1=bla1¶m2=bla2 etc which would be ignored as it seems.
You can't do that using the request manager in the way you currently are.
Instead, you would need to create the parameter list yourself, and then create a request from that. Then you could use AFN to handle the request transmission and response.
Note that the server shouldn't require a specific order and that this should be changed if possible. Note also that the dictionary of parameters has no order (even though you add the keys in a set order).