Objective C:Object Deallocated while key value observers were still registered with it

后端 未结 2 438
南旧
南旧 2020-12-28 17:36

I am hitting the below error after I added 2 additional fields to my core data model.

CarPark_CarPark_ was deallocated while key value observers were still r         


        
相关标签:
2条回答
  • 2020-12-28 18:22

    It's probably due to the observer being deallocated before the objects being observed. You would need to implement the -(void) dealloc method to remove all observed objects in the observer.

    0 讨论(0)
  • 2020-12-28 18:25

    To set the breakpoint open the breakpoints tab in Xcode 4 (Breakpoints window in Xcode 3) and add a new symbolic Breakpoint for the symbol "NSKVODeallocateBreak"

    Use the debugger console to print the observer at the adress given in the observation info

    Observer: 0x19af20

    po 0x19af20
    

    This should give some valuable information about the observer. Override addObserver:forKeyPath:options:context: in your custom CarPark class and set a breakpoint to see the exact location of the observing being established.

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