Hi all,

I'm experiencing the weirdest conditional data loss that I've seen in a long time. One of my managed objects has an NSImage property (stored as Transformable). Now here's the bug in summary: If the app bundle which initially created the persistence file (SQLite or XML) gets moved, the icon property doesn't get restored. If I move the bundle back to where it originally was, it gets restored.

Here's an example of what steps I took to reproduce. Imagine we have the following configuration:
~/Desktop/Folder1/MyApp.app
~/Desktop/Folder2

I launch MyApp for the first time from Folder1 and it all works fine - icons are drawn in the sidebar, etc. Now I quit it and decide to move it Folder2 using Finder. I relaunch MyApp from Folder2 and now all the icons are gone. Quit again, move back to Folder1 and relaunch - icons are back. In fact, if MyApp is run from any location *except* Folder1, there are no icons.

I'm really baffled by this and I have no idea how to go about the problem (considering all the magic happens in the CoreData layers which I have no way to debug). So I decided to log the object and property before I draw it.

Case 1 (running from Folder1):

...
icon = "(...not nil..)";    <--- log of the managed object
...

Logging [obj icon] gives:
icon=NSImage 0x15fc7a20 Size={16, 16} Reps=(
NSBitmapImageRep 0x15fe5dc0 Size={16, 16} ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=32 Pixels=16x16 Alpha=YES Planar=NO Format=2 CGImage=0x15fe6510
)

Case 2 (any other folder apart from Folder1):
...
icon = "(...not nil..)";
...

[obj icon] gives:
icon=NSImage 0x15fc7ef0 Size={0, 0} Reps=(
)

Any hints on what might be causing this are greatly appreciated.

M
_______________________________________________

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