Core Data error
Core Data error
- Subject: Core Data error
- From: Andrew Merenbach <email@hidden>
- Date: Thu, 2 Aug 2007 09:07:12 -0700
Hi, all,
I have a Core Data app that features logging functionality. For this
I use a tree controller which, in a separate thread, assimilates data
from a temporary managed object context. Here's the skeleton of my
thread code's called method:
- (void)logRoll {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSManagedObjectContext *context = [[NSManagedObjectContext
allocWithZone:thisZone] init];
[context setPersistentStoreCoordinator:[self
persistentStoreCoordinatorRef]]; // weak link to app delegate's
persistent store coordinator
NSEntityDescription *dieNodeEntity = [NSEntityDescription
entityForName:@"DieNode" inManagedObjectContext:context];
DXDieNode *dieNode;
dieNode = [[DXDieNode alloc] initWithEntity:dieNodeEntity
insertIntoManagedObjectContext:context]);
// do stuff to die node
[dieNode release];
[logTreeController performSelectorOnMainThread:@selector(fetch:)
withObject:nil waitUntilDone:YES];
[self setSaving:YES]; // app delegate checks this on quit to see if
we can terminate gracefully without causing corruption
NSError *error;
if (![context save:&error]) {
[NSApp performSelectorOnMainThread:@selector(presentError:)
withObject:error waitUntilDone:YES];
}
[self setSaving:NO];
[self performSelectorOnMainThread:@selector(finishLoggingRoll)
withObject:nil waitUntilDone:YES];
[pool release];
}
- (void)finishLoggingRoll {
int numberOfRows = [logOutlineView numberOfRows];
id item;
int i;
for (i = numberOfRows - 1; i >= 0; --i) {
item = [logOutlineView itemAtRow:i];
[logOutlineView expandItem:item];
}
}
The last method is a test; I am in it trying to expand every row of
the log's outline view. I have also tried just doing the most recent
rows. The problem is that, when I try to expand the most recent
item, I get this:
2007-08-02 08:56:16.015 DiceX[6135] *** Assertion failure in -
[AMOutlineView expandItem:expandChildren:], TableView.subproj/
NSOutlineView.m:709
2007-08-02 08:56:16.026 DiceX[6135] *** NSThread: ignoring exception
'Invalid parameter not satisfying: item' that raised during delayed
perform of target 0x332cd0 and selector 'finishLoggingRoll'
Does anyone have an inkling as to why, even after I've performed a -
fetch: on my log tree controller, to which the log outline view is
bound, I would get such as error? Item is definitely appearing to be
nil at at least one point during the expansion process.
Many thanks,
Andrew
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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