Dear List,

I have an NSPersistentDocument app using CoreData for storage. I have three 
NSArrayControllers to mediate between the three Entities in my Model and three 
NSTableViews. Everything works fine until I load a previously saved file. At 
that point, the controllers seem to have no content despite the fact that the 
tables are properly populated. That is, the NSTableView shows data, but po 
[self arrangedObjects] in GDB shows an empty array.
At first I figured it was a timing issue, so I delayed the attempt to 
manipulate an object (accessed by [[self arrangedObjects] objectAtIndex:0]) 
with a message delayed by up to several seconds with no improvement. If I force 
a fetch, I can retrieve the data, but for some reason the controller is not 
taking care of this on its own. I have verified that the controller 
"automatically prepares content," and it's not fetching lazily, per IB. I'm 
sure I've missed something obvious, but I'm stuck. I'm not sure if it's 
relevant, but the value of [self managedObjectContext] is different if I check 
it in the NSPersistentDocument object immediately after - 
(BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)url ofType:(NSString 
*)fileType modelConfiguration:(NSString *)configuration 
storeOptions:(NSDictionary *)storeOptions error:(NSError **)error versus later, 
when my controller tries to manipulate its content. Although I modified the 
document's load method to investigate this (just a call to super followed by a 
break point), the same behavior exists even without overriding this method. If 
the answer is in the Apple Docs, I've missed it because I've read them several 
times now. Incidentally, the "Cannot access contents of an object controller 
after a nib is loaded" section of "Core Data Programming Guide" looked 
promising, and fetchWithRequest:merge:error returns YES, but it still doesn't 
cause the controller to repopulate. I've got perhaps 50 pieces of string data 
stored in this document, so it's not a volume of data issue, I don't think.

Thanks for any insight.
-Dan

The troublesome code, from my NSArrayController subclass, follows. The object, 
myNote, is sent, after a brief delay, from the Nib file of another object. I 
verified it contains a valid NSDate object.

- (void) myChangeStartTime:(NSNotification *)myNote
{
        [self setFilterPredicate:nil];
        [self rearrangeObjects];
        [[[self arrangedObjects] objectAtIndex:0] setValue:[[myNote object] 
dateValue] forKey:kMyDateBindingKey];
}_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to