How to properly trim object graph brought in by NSFetchedResultsController?

前端 未结 2 1554
终归单人心
终归单人心 2021-01-25 05:29

Without reference cycles NSFetchedResultsController can turn its managed objects into fault properly when they are not needed. But with reference cycles, it not, so

相关标签:
2条回答
  • 2021-01-25 05:59

    As I mentioned in my comments HERE, the FRC is responsible to fault-in or fault-out the objects it fetched.
    Which in turn break any strong reference cycles between your managed objects.

    You can test this by setting a breakpoint in your objects willTurnIntoFault method when scrolling a large enough table.

    This is done with no regards as to what other objects reference these fetched objects (as far as I can tell).

    0 讨论(0)
  • 2021-01-25 06:17

    I think you should simply avoid strong reference cycles. Usually, there is no compelling reason to have to deal with the problem you describe.

    For a detailed discussion, see Apple's Encapsulating Data chapter of the Programming with Objective-C guide where you will find a section titled Avoid Strong Reference Cycles.

    0 讨论(0)
提交回复
热议问题