I want a thorough list regarding comparison between the two. Things I have known:
executeFetchRequest
:
You are comparing the wrong elements. NSFetchedResultsController
uses the NSManagedObjectContext
to perform the fetch, and under proper configuration, monitors the changes in the managed object context to verify the status of the fetch properties it is monitoring, but the actual fetches are done by the context. On both cases, NSManagedObjectContext
does the fetch. The difference being that, using the NSManagedObjectContext
directly, you get an NSArray type of object (the actual runtime class is different than an array you get using [NSArray array]
), while NSFetchedResultsController
has a different purpose (have a collection of results and monitor changes to the records and entity on its fetch request). In other words, NSFetchedResultsController
works using the context, but it works different than just a simple collection of objects.
One observation: you shouldn't be using executeFetchRequest
inside a loop, especially calling it "many many times". Each fetch has its performance cost. You can call executeFetchRequest
once, and do a loop to check the result.