Fault data when fetching from CoreData

When you need to quickly display NSArray what you do? Yes, NSLog(@”%@”, myarray), me too. But when you will do this on array fetched from CoreData what will you get? Well, something like:

So what is that? What is surprise – this is not an error, it is normal when you are fetching something, becouse of lazy loading – objects are not fully loaded until you need them. So what can we do? Just a little more work:

This way you will get your array properly displayed, the other way is to [request setReturnsObjectsAsFaults:NO] on your NSFetchRequest but if you will forget to remove it after testing your arrays will always be fully populated which can lead to memory warnings.

Leave a Reply