I have two different NSPersistentDocument subclasses. After a singleton of one 
is created, I call a temporary method to pre-populate it with test data, and 
then call the following code to save the data and clear the undo & dirty state:

    NSManagedObjectContext* moc = self.managedObjectContext;
    NSError* err = nil;
    bool success = [moc save: &err];
    if (!success)
    {
        NSLog(@"Error saving test part defs: %@", err);
    }
    
    [moc processPendingChanges];
    [moc.undoManager removeAllActions];
    [self updateChangeCount: NSChangeCleared];

However, this does not work. I can still undo in the document, and if I try to 
close it, it asks to save (and the close button has a dot).

However, I do the same thing in my other document subclass, inside 
-initWithType:error: (although I don't call -save:), and it works as expected.

Any ideas what might be going on?

Thanks,
Rick

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to