ecordell / RestKit

RestKit is a framework for consuming and modeling restful web resources on OS X and iPhone/iPad
http://www.twotoasters.com/
Apache License 2.0
15 stars 1 forks source link

Added RKSyncStrategy enum for choosing a strategy when queuing requests #2

Closed makdad closed 12 years ago

makdad commented 12 years ago
makdad commented 12 years ago

By the way, is there a need for the DELETE route to have a separate sync implementation? I was confused by:

case RKSyncStatusPut: [_objectManager putObject:[context objectWithID:itemID] delegate:self]; break; case RKSyncStatusDelete: [[_objectManager client] delete:item.objectRoute delegate:self];

Maybe there's something I'm not getting about RestKit (likely, just started using it last month).

Why isn't this just deleteObject: like the others?

ecordell commented 12 years ago

Yes, there's a reason for the different implementation for delete requests.

Once an object is deleted from the managedobjectcontext, it's no longer available to use for finding out which route to use (remember routes can be based on the object itself, like including a uid or something). So for deleted objects, instead of saving a pointer to the object like we do for the others, we just store the route instead.

There's an argument to made for storing the route on all of them, I think.