Search code examples
macoscocoasavensdocument

Why is my dataOfType: not called when saving?


I have an NSDocument that contains a dataOfType method, but it is not called when I do a save.

- (NSData *)dataOfType:(NSString *)typeName 
                 error:(NSError *__autoreleasing *)outError
{
    NSLog(@"db: %@", db);
    return [NSKeyedArchiver archivedDataWithRootObject:db];
}

Why is this not called? Specifically, are there any reasons why my current document should not be the first responder that the menu-item "Save" points to?


Solution

  • Did you leave 'Use Core Data' checkbox unchecked on create new project window?