Note that there are some explanatory texts on larger screens.

plurals
  1. POCoreData throws exception with NSUndoManager
    primarykey
    data
    text
    <p>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.</p> <p>So I have something like this:</p> <pre><code>if (!self.undoManager.isUndoing &amp;&amp; !self.undoManager.isRedoing) { [self.undoManager undo]; } else { NSLog(@"gotcha!"); } </code></pre> <p>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. </p> <pre><code>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 </code></pre> <p>Sometimes I am also getting EXEC_BAD_ACCESS, other times just the exception above.</p> <p>Any idea what could be causing this?</p> <p>Edit: clarified situation for Mundi (see comments)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload