CodeGuru CodeGuru - 1 year ago 112
iOS Question

Pass NSArray as parameter in AFNetworking

How to pass NSArray as a parameter in AFNetworking?
API which i am trying to call is expecting a list(array).
I cannot use dictionary because their is no key.

Answer Source
 AFHTTPRequestOperationManager *manager;

 manager = [AFHTTPRequestOperationManager manager];
 manager.requestSerializer = [AFJSONRequestSerializer serializer];
[manager.requestSerializer setTimeoutInterval:500.0];
[manager POST:strRequestUrl parameters:yourArray success:^(AFHTTPRequestOperation *operation, id responseObject)

     NSString *msg;
     NSData *jsonData = [NSJSONSerialization dataWithJSONObject:responseObject
     NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

 } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download