How to delete local database object which are not available on server using RestKit for iOS

146 Views Asked by At

Hello I have used RestKit for my iPhone application. I fetched the result from server and save into local database. But If we delete the few record from server which are available into my local database. So how I can delete those data entry using RestKit. Have any in build method into RestKit, using that we can easily handle this scenario.

1

There are 1 best solutions below

0
Arasuvel On

Yes. You can use the addFetchRequestBlock to give a fetch request with the predicate, by which you can avoid saving unwanted objects from responses.

So, here in the addFetchRequestBlock, you can give the predicate without any condition for the corresponding URL. So it will delete all objects and will insert new objects.

Reference : http://cocoadocs.org/docsets/RestKit/0.24.0/Classes/RKManagedObjectRequestOperation.html