Re: CoreData Mysterious Conditional Data Loss
Re: CoreData Mysterious Conditional Data Loss
- Subject: Re: CoreData Mysterious Conditional Data Loss
- From: Ken Ferry <email@hidden>
- Date: Thu, 24 Sep 2009 16:32:18 -0700
On Thu, Sep 24, 2009 at 6:59 AM, Milen Dzhumerov <email@hidden> wrote:
>
> On 24 Sep 2009, at 14:20, I. Savant wrote:
>
> We're probably going to need a bit more information than this. You
>> say the icons are "gone". I assume your entity instances are still
>> there and all their other properties are present but only the NSImage
>> attribute is coming back with an empty image?
>>
>
> Correct.
>
> In that case, how exactly are you creating / storing / accessing
>> this image? That seems to be the most relevant part to all this but
>> one which you've completely left out.
>>
>
> You got it right first time, many thanks. The images were created using
> NSImage's initByReferencingFile: which I presume only references the image
> file. That's what I thought at first (that CoreData stored the path to the
> image within the bundle so when the bundle was moved, it couldn't find the
> file) but then I looked at the raw data stored in the XML file (which was
> base64 encoded) and saw the actual PNG data with no filesystem paths. It
> seems that I there's more magic going on behind the scenes. In any case,
> thanks for the help.
I'm not what sure you saw here (perhaps another image?) but you were right
the first time.
If your image is created with initByReferencing:, then the system may treat
the in-memory NSImage as only a cache for the image on disk. It is
undefined when the file is accessed, and the image could choose to throw
away data and later go back to disk if it wanted to.
And in practice, yeah, archiving only saves the URL.
initWithContentsOfURL: makes no such assumptions. The data is brought in
right away and there is no persistent connection to the URL.
>
> M
> _______________________________________________
>
> 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
>
_______________________________________________
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