Cocoa Design Patterns
Learning OpenGL ES for iOS
Presentations
Buy at Amazon Now
  • Cocoa Design Patterns
    Cocoa Design Patterns
    by Erik M. Buck, Donald A. Yacktman
  • Learning OpenGL ES for iOS: A Hands-on Guide to Modern 3D Graphics Programming
    Learning OpenGL ES for iOS: A Hands-on Guide to Modern 3D Graphics Programming
    by Erik M. Buck

Errata > undo in chapter 2 example

I tried recreating the chapter 2 core data example from scratch (without using the downloaded example) and got it working fine except for the undo part. Changes to the managed objects do not appear to be enabling the undo menu items. So I thought I'd done something wrong and downloaded the sample code and tried that and it doesn't work there either. I suspect I am missing something obvious but don't know where to start. I also wonder if this is related to xcode 4 which I am using? Any advice would be most appreciated. I thought basic undo functionality came free when using core data in a simple cocoa app.
July 14, 2011 | Unregistered CommenterJeff Jenkins
I've got it working but it required some more code in the application delegate to override the undo and redo actions and then linking the undo and redo menu items to these actions. Is this necessary or should it just work out of the box? In the downloaded version undo and redo menu items are bound to the undo and redo actions in First Responder.
July 14, 2011 | Unregistered CommenterJeff Jenkins
The downloaded example does support Undo and doesn't have anything additional in the app delegate to support it.
July 30, 2011 | Unregistered CommenterBill Waggoner
Interesting, I wonder why it doesn't work for me here. I guess it must be Xcode 4. Is there maybe a build setting that is stopping it from working as it didn't work in the downloaded version. I must find out!
July 30, 2011 | Unregistered CommenterJeff Jenkins
I've just re-downloaded the project and built it (had to change the SDK as I'm runnign Xcode 4 on Lion) and undo definitely doesn't work. I put an NSLog command in MVCPayCalculator_AppDelegate.m's windowWillReturnUndoManager function and it isn't getting called.
July 30, 2011 | Unregistered CommenterJeff Jenkins
It's odd. I just left the computer to walk the dogs. Came back, tried it again without changing anything and now undo is working on the downloaded version!!!
July 30, 2011 | Unregistered CommenterJeff Jenkins
Weird. I'm on Xcode 4.1 on Lion also and it worked from the get-go for me.
July 30, 2011 | Unregistered CommenterBill Waggoner