Why NSFetchedResultsController is not being updated with new data?

前端 未结 4 755
我在风中等你
我在风中等你 2021-01-18 05:33

My Core Data model has two entities: Author and Book with a To-Many relationship (one author->many books). In the main view I display a list of

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-18 05:56

    Today with Swift everything is easier.

    1. You implement NSFetchedResultsControllerDelegate in your controller
    2. Set your controller as delegate of your NSFetchedResultsController.
    3. Do not use performFetch on your fetchedResultsController, it swallows up the event which normally goes to the delegate.
    4. Change a Managed object -> delegate methods should be called.

提交回复
热议问题