NSFetchedResultsController ignores fetchLimit?

后端 未结 7 2045
春和景丽
春和景丽 2020-12-25 13:58

I have a NSFetchedResultsController to update a UITableView with content from Core Data. It\'s pretty standard stuff I\'m sure you\'ve all seen many times however I am runn

7条回答
  •  难免孤独
    2020-12-25 14:22

    This is my trick:

    I set the NSFetchedResultsController's delegate after 'save' method on the NSManagedObjectContext instance is called.

    1. Set an observer on your UIViewController with a name: eg. 'Sync'
    2. after saving your context, post a notification with that name: 'Sync' and trigger a function (in your viewcontroller) that set the delegate

    ps. remember to remove that observer if you don't need it anymore

提交回复
热议问题