Hi

For the archives, I'll comment on my own question.

On 17/5/09, Steve Steinitz wrote:

I've added code to refresh objects from the database store ... It works well except when another machine has deleted an object. I've
tried several ways of overcoming the NSObjectInaccessibleException

I found that calling refreshObject with mergeChanges: NO doesn't cause that exception, nor any other, faulting the object as it does. However, if I use mergeChanges: NO on all the objects that meet my criteria for remote change I lose some of the user's in-memory changes. So, I now compare the object's modificationDate to the last save date (time). If its newer I use mergeChanges: YES, if older I use mergeChanges: NO.

For a reason that I don't yet fully grasp, I had to use primitiveValueForKey to access the object's modificationDate or else it didn't give the desired result. Perhaps it's to do with the evil manner in which I set the modification date: in a custom, global superclass's didChangeValueForKey. I note that, re the Apple Docs, I am "strongly discouraged from overriding" didChange. A worry...

In any case, so far, its working well, even if two machines delete the same chunk of object graph, and, in other previously troublesome scenarios. I can conceive of scenarios where it might still throw but they are sufficiently perverse that an exception may well be the best outcome.

Cheers,

Steve

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to