views:

54

answers:

1

Hey all,

on viewDidLoad i init my array:

NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Member" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"creationDate" ascending:NO];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[request setSortDescriptors:sortDescriptors];
[sortDescriptors release];
[sortDescriptor release];
NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
[self setMemberArray:mutableFetchResults];
[mutableFetchResults release];
[request release];

this all works like it should, in the TableView i work with the MemberArray, but how and where do i update my array if something changed?

Thanks for your help!

A: 

You should be using a NSFetchedResultsController instead of managing the array yourself. Then you would only need to react to the NSFetchedResultsController delegate methods instead of trying to determine when something has changed.

Marcus S. Zarra