1. 程式人生 > >xcode工程編譯錯誤:"An instance 0xca90200 of class UITableView was deallocated while key value observers were still registered with it"

xcode工程編譯錯誤:"An instance 0xca90200 of class UITableView was deallocated while key value observers were still registered with it"

開始 debugger eve locate obj bsp new 列表 ade

An instance 0xca90200 of class UITableView was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here‘s the current observation info:

<NSKeyValueObservationInfo 0xd253ef0> (

<NSKeyValueObservance 0xc5ea1f0: Observer: 0xc5e9560, Key path: contentOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0xd249490>

<NSKeyValueObservance 0xd26a430: Observer: 0xd241970, Key path: contentSize, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0xd251df0>

<NSKeyValueObservance 0xd26a470: Observer: 0xd241970, Key path: contentOffset, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0xd249490>

)

翻譯的意思大概就是,uitableview註冊了觀察者,然後沒有被註銷掉,又開始重復使用了,我是這麽理解的。
我這個頁面的功能很簡單。就是從列表頁面進入到詳情頁,然後詳情頁的布局是一個scrollview上放了一個uitableview,uitableview繼承了上拉刷新。
我發現這個問題的由來: 當我第一次點詳情頁後,然後返回,第二次進去,然後返回,次數多了以後。然後就Collapse崩潰了。

解決方法:

- (void)dealloc{

[_header free];

[_footer free];
}

xcode工程編譯錯誤:"An instance 0xca90200 of class UITableView was deallocated while key value observers were still registered with it"