Each context in OSX creates an undoManager by default (nil in iOS). The reason for the grouping error was that your child context undoManager was trying to nest changes inside the rootContext's undoManager which was nested inside the startContext undoManager (which was the same as the child context's undoManager).
// create root context
NSManagedObjectContext *rootContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
// startContext is the context created with the document
[rootContext setPersistentStoreCoordinator:[startContext persistentStoreCoordinator]];
[rootContext setUndoManager:startContext.undoManager];
NSManagedObjectContext *childContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
// set root as parent
[childContext setParentContext:rootContext];