Core Data: NSFetchedResultsController ignores returnsObjectsAsFaults:NO on fetch request.

Originator:quellish
Number:rdar://18340594 Date Originated:Mon, 15 Sep 2014 19:43:34 GMT
Status:Open Resolved:
Product:iOS SDK Product Version:8.0
Classification:Performance Reproducible:Always
 
Summary:
When using a fetch request with NSFetchedResultsController, if returnsObjectsAsFaults is set to NO, faults are still returns as results.

Steps to Reproduce:
1. Create an application using a NSFetchedResultsController. An application created with the Xcode template "master-detail application" will work if "Uses core data" is checked.
2. Set returnsObjectsAsFaults to NO on the fetch request: [fetchRequest setReturnsObjectsAsFaults:NO]
3. Perform the fetch using performFetch:

Expected Results:
When the fetch request has setReturnsObjectsAsFaults set to NO, faults should not be returned.
When the fetch request ALSO has fetchBatchSize set, only those objects that have been batch fetched should not be faults.

Actual Results:
Everything is a fault. NSFetchedResultsController seems to fetch using NSManagedObjectIDResultType (regardless of the result type set on the original fetch request), and does not perform batch faulting on top of those results to satisfy the requirements of the developer provided fetch request. 

Version:
iOS 8 (12A365)

Notes:
I believe this worked in iOS 5, but I may be incorrect.

It appears this has been reported before, but I no radar number that this may be duplicating. 

This forums thread describes the problem as well:
https://devforums.apple.com/thread/177752

Though in that case it is not specific to NSFetchedResultsController.

Configuration:
iPhone 5s

Attachments:

Comments

Any updates on this?

By jjramos.developer at June 8, 2017, 5:31 p.m. (reply...)

This is happening to me but with a plain NSFetchRequest, executed against a NSManagedObjectContext of NSPrivateQueueConcurrencyType type, which is directly tied to a NSPersistentStoreCoordinator (no MOC as parent). The fetch request executes and returns all objects as faults. This is happening to me on iOS 9.1 (13B143). I'm doing this against a large number of objects that I know I will be accessing their properties, so there's definitely a performance loss when it later fires a fault for each object.

By gfzabarino at Nov. 18, 2015, 1:40 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!