• 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: right way to gather all elements of a to-many relationship?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: right way to gather all elements of a to-many relationship?


  • Subject: Re: Core Data: right way to gather all elements of a to-many relationship?
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 11 Feb 2009 15:16:27 -0500

On Wed, Feb 11, 2009 at 2:48 PM, Luke Evans <email@hidden> wrote:

> The parent MO is defined with an 'elements' property (nominally an NSSet).

  How? What does this declaration look like in your classes? I assume
you have at least one custom subclass of NSManagedObject specified
(for your "Element" entity), based on the code example you gave, but
it's important to let us know *how* this is declared.

>  So for simply reading the set and converting it to an array, I had imagined
> the following would be OK:
>
> NSArray *elements = [parent.elements allObjects];
>
> Now, this turns out to be bad, as on occasion (and I think, when there are
> no elements), I get the error:
>  *** -[NSCFArray allObjects]: unrecognized selector sent to instance
> <whatever>

  I'd be just as surprised as you - I've never run into this problem
personally and would've expected it to produce a set, not an array.
Then again, I'm still begrudgingly sticking to Obj-C v1 on all but my
newest project, so it may have something (or a lot, or everything) to
do with Obj-C 2's dot syntax or synthesized properties, and not Core
Data.

--
I.S.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

  • Follow-Ups:
    • Re: Core Data: right way to gather all elements of a to-many relationship?
      • From: Luke Evans <email@hidden>
References: 
 >Core Data: right way to gather all elements of a to-many relationship? (From: Luke Evans <email@hidden>)

  • Prev by Date: Core Data: right way to gather all elements of a to-many relationship?
  • Next by Date: Re: Running out of memory when adding CGImageRef-to-NSImage frames to QTMovie in NSOperation subclass
  • Previous by thread: Core Data: right way to gather all elements of a to-many relationship?
  • Next by thread: Re: Core Data: right way to gather all elements of a to-many relationship?
  • Index(es):
    • Date
    • Thread