Get all objects that belongs to a entity in a one-to-many relationship with core data?

I like to add derived methods to access things like this. I add these to the custom class but don't model them in the data model Once you get your accessor working correctly, it should return a mutable set. Then: (NSArray *)noteblockPagesArray { NSMutableSet *pages = self.

NoteblockPages; NSSortDescriptor *sortDescriptor = NSSortDescriptor sortDescriptorWithKey:@"createdAt" ascending:YES; NSArray *orderedPages = pages sortedArrayUsingDescriptors:NSArray arrayWithObject:sortDescriptor; return orderedPages; } Modify to cache value as appropriate/needed.

I like to add derived methods to access things like this. I add these to the custom class but don't model them in the data model. Once you get your accessor working correctly, it should return a mutable set.

Then: - (NSArray *)noteblockPagesArray { NSMutableSet *pages = self. NoteblockPages; NSSortDescriptor *sortDescriptor = NSSortDescriptor sortDescriptorWithKey:@"createdAt" ascending:YES; NSArray *orderedPages = pages sortedArrayUsingDescriptors:NSArray arrayWithObject:sortDescriptor; return orderedPages; } Modify to cache value as appropriate/needed.

Thanks, that looks like a clean solution. Will try it once I solved my accessor problem. – Anders Aug 11 at 22:04 It turned out that the property did get set, I just had to move the NSLog statement to viewWillAppear instead of my init method.

– Anders Aug 12 at 10:59 Think I got it to work, thanks. – Anders Aug 12 at 11:26.

Let CoreData do the work. You have an instance of the Noteblock, correct? YourNoteblock noteblockPages.

Thanks for your answer. I have a instance variable and property called pagesNoteblock that's an instance of Noteblock in my second tableview. I try to set that instance like this in my previous tableview (that is a AQGridView, gridView) in: - (AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index { PagesTableViewController * pagesController = PagesTableViewController alloc init; Noteblock * selectedNoteblock = noteblockList objectAtIndex:index; pagesController setPagesNoteblock:selectedNoteblock; But it doesn't work.

The instance isn't getting set. – Anders Aug 11 at 20:54 I'd focus the effort on finding out why that isn't getting set rather than doing a new query. You might want to pose that as a new question with the relevant bits of code.

Good luck. – picciano Aug 11 at 21:04.

I have currently set all my attributes, relationship to optional. Whatever I do, when I add a new article using the code below, it will add a new Category as well which will contain idCategory = 0 and name = nil if I don't set article. IdCategory and article.name!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions