• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSArrayControllers not repopulating after NSPersistentDocument load
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArrayControllers not repopulating after NSPersistentDocument load


  • Subject: NSArrayControllers not repopulating after NSPersistentDocument load
  • From: Daniel Wambold <email@hidden>
  • Date: Wed, 13 Jan 2010 16:28:18 -0500

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@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

  • Follow-Ups:
    • Re: NSArrayControllers not repopulating after NSPersistentDocument load
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: iPhone: CATransition done (get the key?)
  • Next by Date: Re: NSDirectoryEnumerator and URLs
  • Previous by thread: Re: Trying to create an alias file by using the new NSURL methods available with Mac OS X 10.6 !
  • Next by thread: Re: NSArrayControllers not repopulating after NSPersistentDocument load
  • Index(es):
    • Date
    • Thread