nsfetchedresultscontroller

iOS: Sorting and grouping NSFetchedResultsController

喜欢而已 提交于 2019-12-08 07:56:38
问题 I have two tables with the following structure MainCategory: name position hasSubCategories SubCategory: name position display belongsToMainCategory Now I want to display all subcategories (where display attribute = YES) grouped by main category. The main category sections should be sorted as defined by position and the subcategories itself (within the section) by their position attribute. (name by the way can be the same for a certain main category...my tables have more attributes but they

Deleting object in background moc then refreshing it in main moc causes crash in NSFetchedResultsController update

 ̄綄美尐妖づ 提交于 2019-12-08 06:46:02
问题 I encountered an NSObjectInaccessibleException that I can not understand: *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x8c40040 <x-coredata://85B02C1C-1FFC-4CBF-B7AC-EEA259115427/Event/p6>'' *** First throw call stack: ( 0 CoreFoundation 0x01aa15e4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x018248b6 objc_exception_throw + 44 2 CoreData 0x0025733b _PFFaultHandlerLookupRow + 2715 3 CoreData 0x00256897 -

UICollectionView + NSFetchedResultsController in Swift 3

一世执手 提交于 2019-12-08 06:09:32
问题 In my current project I integrated a NSFetchedResultsController with a UICollectionView which works fine. Currently I try to upgrade the project to Swift 3 and Xcode 8 which causes the following error message This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. I'm using a BlockOperation array to queue up the changes to the UICollectionView . Here is an example of how I insert a new item. self.blockOperations.append

iOS CoreData: NSFetchedResultsController performances

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 05:38:34
问题 In the model, I have two entities: Record and Category. Category is one-to-many with Record through inverse relationship. The persistent store is of SQLITE type and the db is not so small, about 23MB (17k records). I use a list-detail design to show the records table and the detailed record view.The list viewController uses NSFetchedResultsController. Building on the device, if I don't use setFetchBatchSize: CoreData: annotation: sql connection fetch time: 15.8800s CoreData: annotation: total

NSFetchedResultsController: The fetched object at index x has an out of order section name

两盒软妹~` 提交于 2019-12-08 05:22:55
问题 I have three sections in my tableView: Today Upcoming Past When the app launches, the view controller that's launched has an NSFetchedResultsController. If I delete the app and relaunch it in simulator for the first time, it runs great; however, when the date changes, meaning the next day of after, the app gives the error below: 2014-06-29 19:48:35.326 App[37398:4803] CoreData: error: (NSFetchedResultsController) The fetched object at index 4 has an out of order section name ' Upcoming.

iOS: Sorting and grouping NSFetchedResultsController

倾然丶 夕夏残阳落幕 提交于 2019-12-08 03:20:30
I have two tables with the following structure MainCategory: name position hasSubCategories SubCategory: name position display belongsToMainCategory Now I want to display all subcategories (where display attribute = YES) grouped by main category. The main category sections should be sorted as defined by position and the subcategories itself (within the section) by their position attribute. (name by the way can be the same for a certain main category...my tables have more attributes but they aren't relevant to understand the problem). But my order is completely messed up. Why? Here's my code

Fixing predicated NSFetchedResultsController/NSFetchRequest performance with SQLite backend?

北城余情 提交于 2019-12-07 18:35:34
问题 I have a series of NSFetchedResultsControllers powering some table views, and their performance on device was abysmal, on the order of seconds. Since it all runs on main thread, it's blocking my app at startup, which is not great. I investigated and turns out the predicate is the problem: NSPredicate *somePredicate = [NSPredicate predicateWithFormat:@"ANY somethings == %@", something]; [fetchRequest setPredicate:somePredicate]; I.e the fetch entity, call it "things", has a many-to-many

UITableView unexpectedly bounces with beginUpdates()/endUpdates()/performBatchUpdates() using NSFetchedResultsController and CoreData

寵の児 提交于 2019-12-07 16:31:29
问题 UITableView unexpectedly bounces with beginUpdates() / endUpdates() / performBatchUpdates() using NSFetchedResultsController and CoreData when the number of rows fill the view. It's pretty simple to reproduce. - Create a new project from the Master-Detail App Template (with CoreData). - In the storyboard, remove the "showDetail" segue. (we don't need the detail view) - In MasterViewController, replace segue func prepare() with : override func tableView(_ tableView: UITableView, didSelectRowAt

iOS CoreData: NSFetchedResultsController performances

白昼怎懂夜的黑 提交于 2019-12-07 15:50:25
In the model, I have two entities: Record and Category. Category is one-to-many with Record through inverse relationship. The persistent store is of SQLITE type and the db is not so small, about 23MB (17k records). I use a list-detail design to show the records table and the detailed record view.The list viewController uses NSFetchedResultsController. Building on the device, if I don't use setFetchBatchSize: CoreData: annotation: sql connection fetch time: 15.8800s CoreData: annotation: total fetch execution time: 16.9198s for 17028 rows. OMG! If I use setFetchBatchSize:25, everything works

didChangeObject: not called of NSFetchedResultsController

空扰寡人 提交于 2019-12-07 14:28:30
问题 I have nearly tried everything but cannot figure out what is wrong. I have a NSFetchedResultsController and fetch some posts out of core data. Then I have a method where I insert new posts into the same context and save the context. Normally, the didChangeObject: method should be called now, but it does not. I have a similar view controller where I do basically the same on a different table (=nsmanaged object) and there the didChangeObject: method gets called successfully. What I have tried