I would recommend that you export the NSManagedObject subclass and declare your object as that follows:
// At top of the file:
#import "Document.h"
// In your Method:
Document *doc = (Document *)[NSEntityDescription insertNewObjectForEntityForName:@"Document" inManagedObjectContext:self.managedObjectContext];
doc.docName = title.contents;
NSError *error = nil;
[self.managedObjectContext save:&error];
if (error != nil) {
NSLog(@"Oh no! Something terrible happened! Error: %@", error);
}
else {
NSLog(@"Saved! Yay!");
}