Hove to retrieve 'living' objects [CoreData / Bindings]
Hove to retrieve 'living' objects [CoreData / Bindings]
- Subject: Hove to retrieve 'living' objects [CoreData / Bindings]
- From: Stefan <email@hidden>
- Date: Tue, 6 Feb 2007 00:00:48 +0100
In my previous postings I mentioned a problem with a document, which
doesn't 'really' delete managed objects. Starting with a fresh document,
everything seems to be fine regarding the UI.
I still have a similar and likely related problem
Using the below code, I try to get an ordered list of records:
>>>
- (NSArray *)getSortedTransactions {
NSManagedObjectContext *moc = [transactionsArrayControllerOutlet
managedObjectContext];
NSEntityDescription *entityDescription = [NSEntityDescription
entityForName:@"TAMTransaction" inManagedObjectContext:moc];
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:entityDescription];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]
initWithKey:@"trDateCreated" ascending:YES];
[request setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]];
[sortDescriptor release];
NSError *error = nil;
NSArray *array = [moc executeFetchRequest:request error:&error];
return array;
}
<<<
The actual objects returned are sorted. Unfortunately, I get deleted
records too, which
don't appear in the app's GUI's bound NSTableView. This behaviour
persists even if I
save the document and reload it again.
The 'delete' menu of the UI calls 'remove:' for the respective
NSArrayController,
transactionsArrayControllerOutlet in this case.
Do I need to add a predicate, to just get the 'still living' objects
returned?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden