Core Data Smart groups and manual groups
Core Data Smart groups and manual groups
- Subject: Core Data Smart groups and manual groups
- From: Benjamin Dunton <email@hidden>
- Date: Sat, 27 Aug 2005 16:09:12 -0400
All,
I am trying to modify the CoreRecipes smart/manual groups logic to be
similar to smart and normal playlists in iTunes. I have the addition
of tracks to a manual group working just like in iTunes, e.g. the
added track exists both in the manual group as well as the main
library (default data store). Smart playlists work just fine. My
problem comes in when I want to delete an object from a manual
group. I do not want it deleted from the main library, just the group.
Here is how I add the object to the manual group:
if([[[libraryController selection] valueForKey:@"priority"]
intValue] == MANUAL_GROUP_PRIORITY)
{
ManualGroup *manGroup = [[libraryController
selectedObjects] lastObject];
[manGroup addTracksObject:track];
}
[context assignObject:track toPersistentStore:[self
primaryStore]];
// since we didn't add the new object via the array controller,
// we need to tell the array controller to select our new
object.
[tracksController setSelectedObjects:[NSArray
arrayWithObject:track]];
This adds the object to both the manual group, and the main library.
I would think that:
[group removeTracksObject:[tracksController selection]];
would remove the track from only that group. However, the object is
not removed, from the table. The only way that happens is if I use
this:
[tracksController removeObject:[[tracksController selectedObjects]
lastObject]];
But this removes the track object from the group and the main library.
My main library is an inMemory store, whose fetch request is set to
all objects of my sql default data store.
Any help would be appreciated.
Regards,
Ben
_______________________________________________
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