Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:19:11+00:00 2026-06-08T18:19:11+00:00

I have an iPad app where I am using the NSUndoManager with Core Data.

  • 0

I have an iPad app where I am using the NSUndoManager with Core Data. Things usually work well, except that there is a semi-reproducible bug when I undo/redo several times. I am only working on the main thread (at least, I have disabled MagicalRecords from using an NSManagedObject on a secondary thread. The problem always occurs if I try to undo/redo an insertion of an NSManagedObject to the context.

So I have something like this:

if (!self.undoManager.isUndoing && !self.undoManager.isRedoing) 
{
    [self.undoManager undo];   
}
else 
{
    NSLog(@"gotcha!");
}

And after several times, I get the following exception. It happens on a secondary thread, which makes me think Core Data is doing something in the background.

CoreData: error: Serious application error.  Exception was caught during Core Data
change processing.  This is usually a bug within an observer of 
NSManagedObjectContextObjectsDidChangeNotification.  _registerUndoObject:: NSUndoManager 
0xcea2d60 is in invalid state, must begin a group before registering undo
with userInfo (null) 2012-07-25 15:42:26.850 TT[3972:3c07] *** Terminating app due to 
uncaught exception 'NSInternalInconsistencyException', reason: '_registerUndoObject::
NSUndoManager 0xcea2d60 is in invalid state, must begin a group before registering undo

Sometimes I am also getting EXEC_BAD_ACCESS, other times just the exception above.

Any idea what could be causing this?

Edit: clarified situation for Mundi (see comments)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:19:12+00:00Added an answer on June 8, 2026 at 6:19 pm

    Here is the solution that stopped all my crashes:
    Apparently Magical Records uses privateQueue concurrency by default, and if your code isn’t that thread safe, I guess things don’t work out. What I did is change it from NSPrivateQueueConcurrencyType to NSMainQueueConcurrencyType for the following method:

    + (NSManagedObjectContext *) MR_contextWithoutParent;
    {
        NSManagedObjectContext *context = [[self alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
    return context;
    }
    

    I also found another detail that worked here:
    Core Data deleteObject: sets attributes to nil

    What I had to do was save the managed object context before adding/deleting a managed object. Kind of weird and inefficient, but saves lots of trouble.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this iPad app using Storyboard. There are some file that are marked
I have an iPad app that receives data using UDP sockets. And it has
I have an iPad app that is doing really well, zero crashed reported by
I have a graphic-intensive iPad app that features a UIWebView. Using the simulator (iOS
Using iOS 4.3 on an ipad app I have a custom NSOperation that uses
I have an iPad app that I submitted to Apple successfully using my personal
I have just started using UIDatePicker in my iPad app, but is there a
I have a iPad app using XCode4 with Storyboards, that has a Tab Bar
I have an iPad app that is using a sqlite database using FMDB as
I have recently built an iPad app using PhoneGap. Currently it saves the last

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.