This is my dictionary:
{ @"RoutePolyline":<__NSArrayM 0x283983750>(<c59272f7 39263940 55a4c2d8 42f65240>),
@"RideID":6565
};
I am sending this dictionary as an argument in my API call.
and my app crashes at this line of code:
NSData *postData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error];
This is the error it throws:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (NSConcreteValue)'
I know the RoutePolyline parameter is holding a NSValue (it is supposed to be an array of coordinates) and not any object type, but I have tried converting alot, but nothing have worked so far. For example
[NSValue valueWithMKCoordinate:*routeCoordinates]
Loop through your
NSValuearray and extractCLLocationCoordinate2D's value.Also Check if dictionary is valid JSON before serialize