Search code examples
iosresponserestkitnsmanagedobjectcontext

How can I request a managed object in RestKit without it writing it back to the Managed Object Context?


I'm writing a login sequence for an iOS app and I'm using the following path to request user information:

"profiles/:email" (RKRequestMethodGET)

Unfortunately I also have to use this path to check if a certain e-mail address has already been taken as well.

My question is, how do I prevent RestKit from updating/inserting an Account object into the Managed Object Store when I already have an Entity Response Mapping in place for that path? Is there a way to tell the RK request that is shouldn't do any mapping to the Managed Object Store but still report back to me that a successful mapping has occurred?


Solution

  • Not really.

    You could have 2 different RKObjectManager instances, 1 that is used for Core Data and actually updating and managing the users. The other is used without Core Data and just for validation. This allows the 2 different object managers to have different response descriptors.

    An alternative would be to add and remove the response descriptors depending on what requests you're making. But, this is messy and potentially error prone.