Re: Core Data Anomaly?
Re: Core Data Anomaly?
- Subject: Re: Core Data Anomaly?
- From: Richard Somers <email@hidden>
- Date: Thu, 24 Dec 2009 09:47:11 -0700
On Dec 23, 2009, at 9:25 PM, Henry McGilton (Boulevardier) wrote:
On Dec 23, 2009, at 7:41 PM, Richard Somers wrote:
In my application when I do the following something strange happens.
Add a managed object to the store, save the file, then save the
file as another name.
Upon saving the file with another name, core data will create and
then destroy some kind of transitory shadow object of the same kind
as the one in the store.
Is this normal?
Just a wild guess --- are you saving atomically? When writing NSData
objects, as one example, you can write to file atomically, in which
case the object is written to a backup file which is renamed if the
write succeeds. The idea is that the write either succeeds or fails,
but nothing in between that would leave a corrupted file ...
This could be what is happening but I will need to check into it more.
I started with a standard core data project template so I do not know
if I am saving atomically or not. Some of my managed objects are
NSData. The resulting file is not corrupted.
I use -didTurnIntoFault to cleanup caches for the managed objects. The
cache is not created until the managed object is "used" for the first
time. In -didTurnIntoFault I did not check to see if the cache
existed, I just assumed that if the managed object existed it would be
"used" and the cache would exist. Bad assumption. So I was attempting
to remove a non-existing cache on this this transitory shadow object
that was never "used" by my application.
--Richard
_______________________________________________
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