Moving from popup to text field cell in table view core data binding causes exception

  • Hi,

    I am currently working on a quick and dirty CD database-like app using core data, very early in the development.
    I have two entities with properties and a relationship:

    (1) recording
    performer
    recording date
    relationship: recording-work (to-1, i.e. every recording contains one work)
    (2)
    composer
    title
    opus number
    inverse relationship: work-recording (to-many, i.e. there may be many recordings of one single composition/work)

    For experimentation with the model I set up a standard master-detail view using the assistant.
    The work column - as expected - is setup using a popup cell, I made it show the work's title as the value, pretty basic, using the absolutely standard array controller etc., everything works, no problem.

    Now, I'd like to replace the popup cell by a text field cell, to simply show the title - but for the life of me, I can't understand why it seems to be impossible to setup a binding to the property title (or any other) of the entity work.
    Binding the recordings controller's arranged objects to the keypath work.title does not work, as does any other binding I tried. I always get the exception

    "this class is not key value coding-compliant for the key content"

    I am sure I am doing something terribly wrong, but I didn't manage to come up with an explanation/solution either in the docs or on the web.

    How should I solve this problem, with or without bindings?

    Thanks a lot for any pointers!

    Peter
  • On 27 Jun 2012, at 10:51 AM, Peter wrote:

    > Now, I'd like to replace the popup cell by a text field cell, to simply show the title - but for the life of me, I can't understand why it seems to be impossible to setup a binding to the property title (or any other) of the entity work.
    > Binding the recordings controller's arranged objects to the keypath work.title does not work, as does any other binding I tried. I always get the exception
    >
    > "this class is not key value coding-compliant for the key content"

    Pop-up cells have a binding named "content." Text fields do not; they have "value." The full error message named the class that didn't have the key; it would clue you in to what kind of object was having the problem, and narrowed your search away from your model objects.

    How did you change the column cell's class? By dragging the new cell into it, or by changing the class in the identity inspector? Don't do the latter (unless you're setting a custom subclass of what's already there).

    — F

    --
    Fritz Anderson -- Xcode 4 Unleashed: now in the Kindle store -- <http://x4u.manoverboard.org/>
  • Thank you Fritz (and also for your books on Xcode, BTW),

    I found that content in the error message totally cryptic, seemingly unrelated to the respective settings in IB.

    I have torn everything down again and recreated it in between - and what used not to work before works now. I simply got more and more unsure if my conceptual understanding lacked somehow fundamentally. I am relieved to realize it did not.

    This may be a bug in IB 3.2.6 which I am still using.
    I sometimes find binding settings not sticking or getting confused if you change individual settings without disabling the binding completely before and reenabling the binding again after the change. Too much experimenting obviously left IB in a somehow confused state.

    Anyway - works now - sorry for the noise.

    Am 27.06.2012 um 19:42 schrieb Fritz Anderson:

    > On 27 Jun 2012, at 10:51 AM, Peter wrote:
    >
    >> Now, I'd like to replace the popup cell by a text field cell, to simply show the title - but for the life of me, I can't understand why it seems to be impossible to setup a binding to the property title (or any other) of the entity work.
    >> Binding the recordings controller's arranged objects to the keypath work.title does not work, as does any other binding I tried. I always get the exception
    >>
    >> "this class is not key value coding-compliant for the key content"
    >
    > Pop-up cells have a binding named "content." Text fields do not; they have "value." The full error message named the class that didn't have the key; it would clue you in to what kind of object was having the problem, and narrowed your search away from your model objects.
    >
    > How did you change the column cell's class? By dragging the new cell into it, or by changing the class in the identity inspector? Don't do the latter (unless you're setting a custom subclass of what's already there).

    Yes, I know, this is another kind of IB oddity, since it suggests a possibility which won't work in the end.
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today