注意:-棕色的色彩单元是我的播放列表
From Here I can create my playlists
Core data model entity where I save playlist name in playlistName attribute
Core data model Entity where I actually save data for every playlist with attributes mName and mPath
// First Entity
NSManagedObjectContext *context = [self managedObjectContext];
NSManagedObject *devices = [NSEntityDescription insertNewObjectForEntityForName:@"MoviesPlayList" inManagedObjectContext:context];
//Second Entity
NSManagedObject *devices1 = [NSEntityDescription insertNewObjectForEntityForName:@"MoviesInsidePlaylist" inManagedObjectContext:context];
[devices setValue:self.createPlaylistNameTf.text forKey:@"playlistName"];
// [devices setValue:self.createPlaylistNameTf.text forKey:@"pName"];
// [devices setValue:self.createPlaylistNameTf.text forKey:@"pPath"];
NSString *playlistNumber = [NSString stringWithFormat:@"%d",self.SelectedTag];
[devices setValue:playlistNumber forKey:@"pId"];
[self fetchMovieDetail];
// NSLog(@"%@",[[self.moviesarray objectAtIndex:self.SelectedTag]valueForKey:@"name"]);
[devices1 setValue:[[self.moviesarray objectAtIndex:self.SelectedTag]valueForKey:@"name"] forKey:@"mName"];
[devices1 setValue:[[self.moviesarray objectAtIndex:self.SelectedTag]valueForKey:@"path"] forKey:@"mPath"];
[devices setValue:devices1 forKey:@"movieList"];
// Save Managed Object Context
NSError *error = nil;
[devices1.managedObjectContext save:&error];
if (![devices1.managedObjectContext save:&error]) {
NSLog(@"Unable to save managed object context.");
NSLog(@"%@, %@", error, error.localizedDescription);
}
我创建了一个核心数据关系名称movieList,并将该对象添加到名为MoviesPlaylist的主要Coredata实体上
问题:-我想将每个播放列表的内部数据都分开。
但是现在,当我创建播放列表时,所有播放列表中的内部数据都是相同的。
我想区分每个播放列表的数据,我是核心数据的新手,请告诉我方法。或解决方案