Konstantin.Efimenko Konstantin.Efimenko - 21 days ago 4x
iOS Question

Right way to pass NSArray of NSNumber as parameter in AFNetworking

I am trying to send in POST request AFNetworking this package:

NSDictionary*parameters = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@719,@714, nil],@"rules", nil];

[manager POST:path parameters:parameters success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
triedAuthorize = NO;

} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {


And server returns error as if I made error in JSON

In this case server returns success:

NSDictionary*parameters = @{@"rules":@"[719,714]"}

and this is cuccessful to

NSDictionary*parameters = @{@"rules":@"719,714"}


I've solved this

Problem was not in array as parameter. I've added this and everything work:

manager.requestSerializer = [ALFJSONRequestSerializer serializer];