• 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
CoreData and mutableArrayValueForKey:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreData and mutableArrayValueForKey:


  • Subject: CoreData and mutableArrayValueForKey:
  • From: Alex Duzik <email@hidden>
  • Date: Sat, 30 Aug 2008 16:23:35 -0500

Hi all,

I'm writing an app where one Core Data entity -- Folder -- has (conceptually) a to-many relationship with another object -- Item. But I want to keep those items in a particular order, so I have a third entity, OrderedItem, which keeps a reference to the folder along with a reference to the item and also adds an order attribute to track the item's position in the folder.

This is rather cumbersome to maintain, so I've implemented the key- value coding methods for a to-many relationship:

- (NSUInteger) countOfItems
- (Item *)objectInItemsAtIndex:(NSUInteger)index;
- (void)insertObject:(Item *)item inObjectsAtIndex:(NSUInteger)index;
- (void)removeObjectFromItemsAtIndex:(NSUInteger)index;

This works really well just about everywhere. However, in my window controller's delete: method, calling mutableArrayValueForKey:@"items" gives me this exception:

2008-08-30 16:11:27.718 MyApp[6436:813] *** - [NSKeyValueFastMutableArray2 count]: value for key items of object 0x2a7dc0 is nil

Any ideas?

Thanks,
Alex
_______________________________________________

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: CoreData and mutableArrayValueForKey:
      • From: Chris Hanson <email@hidden>
    • Re: CoreData and mutableArrayValueForKey:
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Simple Array of Strings Binding Question
  • Next by Date: Newbie question: What does "no-op" mean?
  • Previous by thread: Re: Simple Array of Strings Binding Question
  • Next by thread: Re: CoreData and mutableArrayValueForKey:
  • Index(es):
    • Date
    • Thread