I am in the process of writing an NSIncrementalStore
that is backed by a REST service. It works nicely for POSTing and GETing objects, but when DELETEing them I encounter the following problem:
- test calls
[context delete: object];
context.deletedObjects
containsobject
(as one would expect)- test calls
[context save: &error];
- iOS calls
NSIncrementalStore
sexecuteRequest:withContext:error:
with aNSSaveChangesRequest
; when the call arrives bothcontext.deletedObjects == nil
andsaveChangesRequest.deletedObjects == nil
, so my code cannot find out which objects to DELETE from the server.
How can it happen that deletedObjects
is set to nil
between the call to the context's save
and its invocation its NSIncrementalStore
?
UPDATE possible cause: object.objectID
is still a temporaryID
following save
. The NSIncrementalStore
is currently obtaining object IDs from newObjectIDForEntity:referenceObject:
and the description from Apple's documentation somehow does not seem to apply yet:
New objects inserted into a managed object context are assigned a temporary ID which is replaced with a permanent one once the object gets saved to a persistent store.