hi,

in the NSPersistentDocument Core Data tutorial, apple includes
the below code. my question is whether there should not also
be another call to processPendingChanges before the call
to disableUndoRegistration? i have seen several examples
of code online which do call it twice, and it would seem to
make more sense.

thanks for any tips,
_c

- (id)initWithType:(NSString *)type error:(NSError **)error
{
    self = [super initWithType:type error:error];
    if (self != nil) {
        NSManagedObjectContext *managedObjectContext = [self
managedObjectContext];
        [[managedObjectContext undoManager] disableUndoRegistration];
        self.department = [NSEntityDescription
insertNewObjectForEntityForName:@"Department"
                inManagedObjectContext:managedObjectContext];
        [managedObjectContext processPendingChanges];
        [[managedObjectContext undoManager] enableUndoRegistration];
    }
    return self;
}
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to