Does MagicalRecord support undo/redo with NSUndoManager? #251

Closed
chrischen-melb opened this Issue Sep 10, 2012 · 3 comments

Comments

Projects
None yet
2 participants

Here's what I wrote in my appDelegate:

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    // Override point for customization after application launch.
    [MagicalRecord setupAutoMigratingCoreDataStack];
    NSUndoManager *undo = [[NSUndoManager alloc] init];
    [[NSManagedObjectContext MR_context] setUndoManager:undo];

    return YES;
    }

but later on, when I observer:
NSLog(@"%p", [NSManagedObjectContext MR_context].undoManager);

the result is always nothing, so the undoManager has never been instantiated.

Member

blackgold9 commented Sep 10, 2012

What thread were you on when that happened?
On Sep 9, 2012, at 7:21 PM, Chris Chen notifications@github.com wrote:

Here's what I wrote in my appDelegate:

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[MagicalRecord setupAutoMigratingCoreDataStack];
NSUndoManager *undo = [[NSUndoManager alloc] init];
[[NSManagedObjectContext MR_context] setUndoManager:undo];

return YES;
}

but later on, when I observer:
NSLog(@"%p", [NSManagedObjectContext MR_context].undoManager);

the result is always nothing, so the undoManager has never been instantiated.


Reply to this email directly or view it on GitHub.

I didn't use thread nor GCD, I think I'm on main thread.

Member

blackgold9 commented Sep 23, 2012

MR_Context generates a new child context of the main context every time. It will not have an undo-manager set, but it's parent will

blackgold9 closed this Sep 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment