Using the development branch of restkit (0.20), is there a way to perform mapping on a JSON string into the core data object store?
I know in 0.10, the method described at the bottom of this page worked but how is this operation performed in restkit 0.20? Any guidance appreciated! Thanks!
id<RKParser> parser = [[RKParserRegistry sharedRegistry] parserForMIMEType:MIMEType];
id parsedData = [parser objectFromString:JSONString error:&error];
RKObjectMappingProvider* mappingProvider = [RKObjectManager sharedManager].mappingProvider;
RKObjectMapper* mapper = [RKObjectMapper mapperWithObject:parsedData mappingProvider:mappingProvider];
RKObjectMappingResult* result = [mapper performMapping];
I installed RESTKit v0.20.0pre4 yesterday and had the same need for one particular case.
Here is an example of the JSON String I want to map:
This is how I perform the mapping.
These posts led me to the solution I have suggested:
https://github.com/RestKit/RestKit/issues/999
https://groups.google.com/d/topic/restkit/M1d7WwcFBDA/discussion
I hope it helps. I guess some other will give better solutions when the final version will be released (with better documentation too…).