MKNetworkOperation *op = [self operationWithPath:@"thestore/services/storeservice.svc/getfavorites" params:fetchedObjects httpMethod:@"POST"];
The fetechedObjects is an array. I can loop through the array to get the values I need to put into the POST request body
[
{
"id": 9222,
"latitude": 19.7897,
"longitude": -64.0208
},
{
"id": 7832,
"latitude": 79.7713,
"longitude": -44.1084
}
]
But I can't figure out how to use the MKNetworkOperation
The first thing to try is to set the postDataEncoding
property of the operation to MKNKPostDataEncodingTypeJSON
. This should cause the array to be serialized and set as the request body.
However, MKNetworkKit
doesn't really support array values for the params
parameter; it expects a dictionary. If you hit the wrong code path, it could crash because it expects a dictionary where you've provided an array.