Question

I've got to be missing something simple, but Google is not helping.

My file saves and loads fine. (I've overridden dataOfType to get some stuff in it.) Then I override fileWrapperOfType (in preparation for creating a bundle), and I get a "The document 'Untitled' could not be saved as 'test'." sheet when I try to save. Even when I empty out my method to the absolute most basic form I can think of...

- (NSFileWrapper*)fileWrapperOfType:(NSString*)typeName error:(NSError**)outError
{
  NSFileWrapper* worldWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:nil];
  return [worldWrapper autorelease];
}

...I still can't save. What am I missing?

Was it helpful?

Solution

From the docs (emphasis mine):

The dictionary must contain entries whose values are the file wrappers that are to become children and whose keys are filenames.

You use nil so my guess is that worldWrapper is nil, and returning nil is interpreted as not being able to save your file.

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