Question

I am using MagicalRecord to handle all my CoreData Stuff that's going on and NSFetchedResultsControllers to display the data in TableViews and CollectionViews.

The problem is, that somewhere in my app, I seem to have a problem with a "CoreData could not fulfill a fault" Exception.

Is there a solution to set a breakpoint to this part of my app? The main problem I have, is that it's crashing and I have no idea where to find it! The "All Exception" breakpoints doesn't seem to help...

Btw. I am not retaining any managedObjects... That makes it even more weird for me...

Any help is appreciated

Was it helpful?

Solution

This error happens when your code (or MagicalRecord) retains an object that is deleted by CoreData in a managed object context, usually on another thread. I would make sure I am not storing temporary objects or objects that may be deleted as properties, in collections, etc. Because you mentioned you don't, I would make sure I don't have threading code that might be out of sync, and ultimately, I would make sure MagicalRecord doesn't have some threaded background deletes or faux garbage collection for the one-to-many relationship classes or something of that sort that could be causing the issue.

As a solution you could check for fault objects manually to avoid the crashes. Look at this question for ways to do that: How can I tell whether an `NSManagedObject` has been deleted?

Sorry if this is too generic, but without seeing your application it is hard to say why exactly you are getting the error.

OTHER TIPS

Maybe moving away from third party frameworks like MagicalRecord could help. I have experienced that these frameworks add little value and potentially create havoc.

I do not think that not retaining managed objects has anything to do with this.

Another suggestion is that you could make extensive use of log statements in your code where managed objects are accessed. This should help you narrow down the possible location of your error. Combined with Instruments you might catch the culprit soon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top