• 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
Core Data, NSArrayController and remove:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data, NSArrayController and remove:


  • Subject: Core Data, NSArrayController and remove:
  • From: "Stephen F. Booth" <email@hidden>
  • Date: Tue, 17 Oct 2006 00:36:43 -0700

Hi All,

I'm working on my first Core Data app, so please bear with me! I've run into something that took me quite by surprise, and although I assume this is how things work with Core Data I'm not sure I understand why.

I've modeled two entities: AudioStream and Playlist. Each has an optional, to-many relationship called playlists and streams, respectively. Using IB I've created two tables in a view, one for displaying streams and one for displaying playlists. As a next step, I created add and remove buttons for adding and removing streams to playlists. Add has some custom logic but remove I initially wired to the NSArrayController's remove: selector.

Here is what caught me off guard:
When displaying streams for a given playlist, and the remove button is clicked, the streams relationship (of the Playlist entity) is modified- the AudioStream object is removed- but the playlists relationship (of the AudioStream entity) remains unchanged. It seems the array controller is only invalidating half of the relationship. I'm not sure why this is happening; the code
playlistSet = [streamObject mutableSetValueForKey:@"playlists"];
[playlistSet removeObject:playlistObject];
modifies both the playlists and inverse streams relationship.


Is there some property I should be setting on the NSArrayController to have it modify both relationships?

Thanks,
Stephen
_______________________________________________
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


  • Prev by Date: Re: Localized string coming displaying in All Caps
  • Next by Date: Do something when an NSTextView gains focus
  • Previous by thread: Prevent NSPopupButton from showing its menu
  • Next by thread: Do something when an NSTextView gains focus
  • Index(es):
    • Date
    • Thread