Question

Does anyone know this issue?

I am writing in a file package (with methods of NSDocument), via

[(NSFileWrapper *)content writeToURL:myURL
                             options:NSFileWrapperWritingAtomic | NSFileWrapperWritingWithNameUpdating
                 originalContentsURL:myURL
                               error:error];

When I look at the content of the file package, it is not updated: the new files won't appear and the old files stay there. If I try and open an old file (that is supposed not to be here anymore), I got an error message (in the Finder) : "can't find..."

What is the problem:

  • am I playing in a wrong way with NSFileWrapper?

  • is there a problem with updating infos of files "hidden" in packages?


edit

  • I don't have any error when writing.

  • I am not using NSDocument methods because I need the support of Core Data. I use a classe called BSManagedDocument that subclasses NSDocument.

  • A maybe related problem is that, when I don't use the NSFileWrapperWritingAtomic option, I get an error "cannot write, because a file (my directory!!!) called ... already exists"

Was it helpful?

Solution

I've seen this - it appears to a be a Finder bug. Are you looking at the contents of your file package by selecting the package in Finder and then right clicking to invoke the menu item Show Package Contents?

If so, that's a problem because Finder caches package contents and won't show you the updates.

Try looking at your file package contents in the terminal using the ls command as in:

ls -al /Path/to/Your/FilePackage

That should show the new package contents.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top