I have a fairly simple application using Core Data and a couple of Array Controllers (in IB, without code files for them, except for the xcdatamodel file). When I launch my application, I get the following error in the log (the application still works, but the window does not appear until I go to File> New Document):
2011-02-08 18:45:10.434 MyApp[35178:a0f] *** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)
I have no references in my myDocument.h or .m files to an array. The error is not critical (the application is still working), but it disables part of my code to load the last used document or (if this does not exist) loads a new document. The application simply loads without visible windows. I would greatly appreciate some help on this and would quickly award an answer.
EDIT: Here is the application code of ShouldOpenUntitledFile:
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
NSArray* urls = [[NSDocumentController sharedDocumentController] recentDocumentURLs];
if ([urls count] > 0){
NSURL *lastURL= [urls objectAtIndex: 0];
[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:lastURL display:YES error:nil];
return NO;
}
return YES;
}