• 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: Core data model - binding question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core data model - binding question


  • Subject: Re: Core data model - binding question
  • From: John Timmer <email@hidden>
  • Date: Wed, 14 Sep 2005 10:09:13 -0400

> Thanks for your suggestion, it works perfectly.
> I bind the array controller to selection.passages and the column of
> the table to book.author.
> Now my problem is eliminating duplicates: when a topic is associated
> to more than one passage of the same book I get the author name
> duplicated in the table. I tried t bind the table column to
> email@hiddenr, but I get this message in the log:
>
> 2005-09-14 10:53:42.431 BiblioBeta[21410] [<BibliographicEntry
> 0x3182a0> valueForUndefinedKey:]: this class is not key value coding-
> compliant for the key @distinctUnionOfArrays.
>
> I also tried to put the @distinctUnionOfArrays in different
> positions, but I get the same log, and the table doesn't work.
> Any suggestion?

Yes.  The problem with array operators like @distinctUnion and @count are
that they are effectively read-only, while key/value coding requires it to
be read-write.  The trick is to hide the array operator behind some other
code that provides both getter/setter methods.

In this case, I'd recommend making your passage object an NSManagedObject
subclass, and add code something like:

- (NSArray *) distinctAuthors {
    return [[[self mutableSetValueForKey: @"authors"] allObjects]
valueForKey: @"distinctUnionOfArrays.author"];
}


- (void) setDistinctAuthors {
    return;
}

(note - I wrote the return line from memory, so check syntax on that)

This allows the distinct array to be key/value coding compliant.

Cheers,

JT

_______________________________________________
This mind intentionally left blank


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Core data model - binding question
      • From: Davide Benini <email@hidden>
References: 
 >Re: Core data model - binding question (From: Davide Benini <email@hidden>)

  • Prev by Date: Re: Cocoa for small applications
  • Next by Date: Re: null selector
  • Previous by thread: Re: Core data model - binding question
  • Next by thread: Re: Core data model - binding question
  • Index(es):
    • Date
    • Thread