• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSObjectController and Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObjectController and Core Data


  • Subject: Re: NSObjectController and Core Data
  • From: "Kevin" <email@hidden>
  • Date: Fri, 23 Feb 2007 20:10:28 +0000
  • Importance: Normal
  • Sensitivity: Normal

The problem is stated in my original post but to summarize:

Changes in a textview that is bound to an NSObjectController in entity mode (created programmatically) are not recorded if the managed object context is saved WITHOUT leaving the text view.

On the other hand, if the NSObjectController is created and set up in Interface Builder, everything works fine.

For some reason, NSObjectController (when created programmatically) does not register with the managed object context as an editor when the contents of the text view are changed.

By subclassing NSObjectController and simply putting NSLog statements in objectDidBeginEditing: and calling super's implementation, I can see that it gets called when I start editing my text view. However, commitEditing is never called if I save the managed object context without leaving the text view.

The situation is only remedied if I subclass NSObjectController and explicity register/deregister the object controller with the context by calling [[self managedConext] objectDidBeginEditing:self] and [[self managedConext] objectDidEndEditing:self] in objectDidbeginEditing: and objectDidEndEditing:, respectively.

Kevin

Sent via BlackBerry from Cingular Wireless

-----Original Message-----
From: mmalc crawford <email@hidden>
Date: Fri, 23 Feb 2007 11:21:45
To:email@hidden
Cc:cocoa-dev List <email@hidden>
Subject: Re: NSObjectController and Core Data


On Feb 23, 2007, at 10:16 AM, Kevin wrote:

> Swapping the order of the calls does not appear to make a
> difference. The object controller is able to fetch the data without
> any errors regardless of the order of calls.
>
It's not clear what your problem is.
You stated:

On Feb 22, 2007, at 6:03 AM, Kevin wrote:
> Even though the object controller is created in identical fashion in
> both nib file and programmatically, the one created programmatically
> seems to be stuck in "Object" mode.
> [...]
> If anyone knows how I can force the controller to be in "Entity"
> mode programmatically, I'd like to hear it.
>
This is remedied by reversing the two lines...

mmalc

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Fw: NSObjectController and Core Data (From: "Kevin" <email@hidden>)
 >Re: NSObjectController and Core Data (From: Kevin <email@hidden>)
 >Re: NSObjectController and Core Data (From: "Sean McBride" <email@hidden>)
 >Re: NSObjectController and Core Data (From: "Kevin" <email@hidden>)
 >Re: NSObjectController and Core Data (From: mmalc crawford <email@hidden>)
 >Re: NSObjectController and Core Data (From: "Kevin" <email@hidden>)
 >Re: NSObjectController and Core Data (From: mmalc crawford <email@hidden>)

  • Prev by Date: drawRect problem
  • Next by Date: Re: NSTableView with LARGE dataset
  • Previous by thread: Re: NSObjectController and Core Data
  • Next by thread: Re: NSObjectController and Core Data
  • Index(es):
    • Date
    • Thread