refreshObject throws for object no longer in database
refreshObject throws for object no longer in database
- Subject: refreshObject throws for object no longer in database
- From: Steve Steinitz <email@hidden>
- Date: Sun, 17 May 2009 22:02:03 +1000
Hello,
I'm using Core Data for a multi-user point-of-sale system. To
overcome occasional exceptions on save, I've added code to
refresh objects from the database store (using a sort of souped
up [context refreshObject:]) periodically during idle and, if
needed, just before key operations like create sale, add
lineItem, add payment, close sale...
To discover which objects to refresh, I timestamp all changes to
objects then fetch the ones that have changed since the last
save (more or less) and refresh those.
It works well except when another machine has deleted an
object. I've tried several ways of overcoming the NSObjectInaccessibleException:
catching the exception and doing:
[context deleteObject:] -- causes validation errors
and doesn't seem right anyway
other other stuff that seems silly now
Before refresh, doing the following then checking if the
object still exists
[arrayController fetch] -- doesn't help
[arrayController rearrangeObjects] -- doesn't help
Even if I could successfully refresh the object I'd still be
left with a 'zombie' object (or worse, re-introduce it into the
database store).
What is the best way of identifying and getting rid of these
zombie objects?
Thanks,
Steve
ps. Perhaps my timing is not the best given the current debate
(on this list) about Core Data's multi-user capabilities. As
much as I appreciate the participants' efforts in guiding Core
Data's future direction, please don't consider my question to be
part of the debate.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden