我正在實現基於MKMapView的應用程序。在我點擊一個別針時,我正在使用觀察者。觀察者代碼如下,使用KVO時出現異常
[annView addObserver:self
forKeyPath:@"selected"
options:NSKeyValueObservingOptionNew
context:@"ANSELECTED"];
它正在爲例外,但過一段時間就越來越例外「EXC_BAD_ACCESS」。我的日誌如下,它顯示我泄漏的內存。我需要釋放服務器嗎?如果我 ?那麼我應該在哪裏發佈這個?你們能幫我解決嗎?
An instance 0x1b21f0 of class MKAnnotationView is being deallocated while key value observers are still registered with it. Observation info is being 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:
( 語境:0x2b588,物業:0x1acaa0>
由於提前, S.
而是志願的,爲什麼不直接使用didSelectAnnotationView委託方法? – Anna 2010-11-01 18:10:54