Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Data fault fulfilled from database for - is normal?

I have problem with this adnnotation.I have downloaded several tutorials e.g.: http://www.raywenderlich.com/14742/core-data-on-ios-5-tutorial-how-to-work-with-relations-and-predicates and in this sample code "fault fulfilled" message is visible too. My question is:

  • It is possible to create and fetch data from Core Data without this alert?
  • Does a very critical alert in Core Data?

My database looks like this: My database looks that:

And problem occur when I want to fetch data from "FailedBankDetails" table, e.g. "closeDate".

First I fetch all rows from "FailedBankInfo" table (code above):

    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];

NSEntityDescription *entity = [NSEntityDescription
                               entityForName:@"FailedBankInfo" inManagedObjectContext:self.managedObjectContext];

NSSortDescriptor *sort = [[NSSortDescriptor alloc]
                          initWithKey:@"name" ascending:NO];

[fetchRequest setEntity:entity];

[fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];
[fetchRequest setFetchBatchSize:20];

NSFetchedResultsController *theFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
                                                                                              managedObjectContext:self.managedObjectContext
                                                                                                sectionNameKeyPath:nil
                                                                                                         cacheName:nil];
self.fetchedResultsController = theFetchedResultsController;
_fetchedResultsController.delegate = self;

Next I want to display data using table cell:

 if ([[_fetchedResultsController objectAtIndexPath:indexPath] isKindOfClass:[FailedBankInfo class]]) {
    FailedBankInfo *info = [_fetchedResultsController objectAtIndexPath:indexPath];
    cell.textLabel.text = info.name;
    cell.detailTextLabel.text = [NSString stringWithFormat:@"%@, %@", info.city, info.details.closeDate];

}

I my opinion accessing to info.details.closeDate occur "fault fulfilled" alert, because when I change this e.g. to info.name this alert not appear.

There is other way to access to "closeDate" field related with a specific "FailedBankInfo" object?

I'm tired of solving this problem, please send me some good advice.

This is my alert:

2014-02-16 09:05:45.801 FailedBankCD[57158:70b] CoreData: annotation: fault fulfilled from database for : 0x8ba2d60

like image 643
Robert Avatar asked Dec 16 '22 01:12

Robert


1 Answers

What you are seeing is normal - core data logging is enabled for your app (this will be under the arguments section of your debug scheme).

A "fault", despite the name, is not a problem. It's a core data optimisation whereby full objects are not retrieved from the database until their properties are accessed, at which point the "fault" is "fulfilled".

They didn't have beginners in mind when choosing the language, I think.

like image 63
jrturton Avatar answered Feb 14 '23 04:02

jrturton