So I'm trying to do a post request with an array of JSON parameters sent to a server, here's the code for that
for(USER_ACTIONS *ua in [USER_ACTIONS listRegisterdActions]){
//Create a single JSON object here
[array addObject:jsonString];
}
NSString *dataString = [NSString stringWithFormat:@"[%@]",array.count ?
NSData* data = [dataString dataUsingEncoding:NSUTF8StringEncoding];
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
parameters[@"data"] = data;
[self POST:@"?cmd=log" parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) {
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
This works with a single JSON object, but once there are more of them I get the following exception
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (NSConcreteMutableData)'
It's out of the question to do this with a multiple post requests so I need a way to do this with one, my search results on this have not gotten any clear results on how to do this with AFNetworking 2.x so I'd appreciate some pointers on where to go with this.