I have provided with a sample JSON file (for testing purpose I haven't early access to the web service). after loading the file and converting to NSDictionary
how can I use that dictionary and sync my data base? all the tutorials and samples I've read use web service
I have created my mapping for all of the objects and applied their relationship.
an example:
+ (RKEntityMapping *) mapTableInManagedObjectStore:(RKManagedObjectStore *)managedObjectStore
{
RKEntityMapping *tableMapping = [RKEntityMapping mappingForEntityForName:@"Table" inManagedObjectStore:managedObjectStore];
tableMapping.identificationAttributes = @[@"tableID"];
[tableMapping addAttributeMappingsFromDictionary:@{
@"ID":@"tableID",
@"TableNumber":@"tableNumber",
@"NumberOfChairs":@"numberOfChairs"}];
return tableMapping;
}
Here is how I did and works well:
RKMappingOperation job is to map values from source object to destination object.
now table attributes are updated with tableDic values. (table is kind of
NSManagedObject
)