I am developing a todo list app using RestKit on iOS, i have added a fetch results block for deletion of orphaned objects from official class reference from this link (http://restkit.org/api/latest/Classes/RKManagedObjectRequestOperation.html)
Now the documentation says whenever any RKManagedObjectRequestOperations execute, the fetch result block will check for orphaned objects and delete the objects automatically that are not present on server.
I am using the following code to make request, but the problem is getObjectsAtPath creates RKObjectRequestOperation and I need RKManagedObjectRequestOperation can any one guide me on what to do in this scenario?
With RKObjectRequestOperation the orphaned objects are not getting deleted if they no longer exist on server.
[[RKObjectManager sharedManager] getObjectsAtPath:@"/api/lists"
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) ...
Mapping:
RKEntityMapping *listEntityMapping = [RKEntityMapping mappingForEntityForName:@"List" inManagedObjectStore:managedObjectStore];
Response descriptor:
responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:listEntityMapping method:RKRequestMethodGET pathPattern:@"/api/lists" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
JSON:
[
{
"list_id": "1",
"listName": "List Name 1"
},
{
"list_id": "2",
"listName": "List Name 2"
},
{
"list_id": "5",
"listName": "List Name 3"
},
{
"list_id": "7",
"listName": "List Name 4"
},
{
"list_id": "8",
"listName": "List Name 5"
},
{
"list_id": "11",
"listName": "List Name 6"
},
{
"list_id": "12",
"listName": "List Name 7"
}
]