ios - KVO message sent to deallocated instance error. even if observer removed -


I need to locate the tableview content because I use KVO, and everything works perfectly . I also have a UIActivityViewController service in the same view controller. If I use the service from UIActiview controller and then after the sack, I pop the view controller, I get the follow-up error ... < Pre> * frame # 0: 0x0000000183071280 Core forwarding `___ forwarding ___ + 736 frame # 1: 0x0000000182f9108c CoreFoundation___forwarding_prep_0___ + 92 frames # 2: 0x0000000183b2e7d0 Foundation`NSKeyValuePushPendingNotificationPerThread + 340 Frame # 3: 0x0000000183b19068 Foundation`NSKeyValueWillChange + 532 frame # 4: 0x00000 00183b023a8 Foundation`- [NSObject (NSKeyValueObserverNotification) willChangeValueForKey:] 236 Frame # 5: 0x0000000183bc9148 Foundation`_NSSetPointValueAndNotify + 116 frame # 6: 0x00000001863126c0 UIKit`- [UIScrollView (UIScrollViewInternal) _adjustContentOffsetIfNecessary] 864 Frame # 7: 0x0000000186116a0c UIKit`- [UIScrollView ( UIScrollViewInternal _stopScrollingNotify: Pin: tramplingDragFlags: 352 frame # 8: 0x0000000186116864 UIKit`- [UIScrollView removeFromSuperview] + 44 Frame # 9: 0x000000018603377c UIKit`- [UIView Dealloc] + 424 Frame # 10: 0x0000000182 F6694 Core Forwarding `CFREEEE + 468 frame # 11: 0x0000000182 Fenzak 0 Corfundation - [__ NSAMM Delok] + 156 frame # 12: 0x000000018f58d474LibobayJayC.ADII ी` (anonymous namespace) :: Autorespillage :: Pop (Zero *) + 524 Frame # 13: 0x0000000182f6d438 CoreFoundation`_CFAutoreleasePoolPop + 28 Frame # 14: 0x000000018302c974 CoreFoundation`__CFRunLoopRun + 1460 Frame # 15: 0x0000000182f6d6d0 CoreFoundation`CFRunLoopRunSpecific + 452 Frame # 16: 0x0000000188c51c0c GraphicsServices`GSEventRunModal + 168 Frame # 17: UIKit`UIApplicationMain 0x000000018609efdc + 1156

I use the following lines to add or remove KOVO

  - (void) ViewViewPaper: (BOOL) Animated {self.tableView addObserver: Self PayPal for: @ "Content Offset" option SC: NSKAlvAbAbSySationalOnNew reference: zero]; } - (zero) viewviewYou: (BOOL) animated {[remove self.tableViewAbSverver: Path to Self: @ "Content Offset"]; }   

Keep in mind that whether you added your supervisor or not. It is possible that when your activity view indicator controller is presented, you can not see the viewview , even if you return by looking at viewWillAppear . Thus, when you dismiss your view controller, you add the supervisor twice, but only removing it once. Enter

some NSLog and I'm sure you will find view your call to view and viewWillAppear As a result, I am convinced that you are adding inspectors more often than removing it.

By adding property to a state, by looking at content offset , you can remedy it:

  @property (nonatomic) is watching the BOOLSupport offset ;   

You can still get your code that the supervisor adds and removes this property check:

  - (zero) viewViewAppear: (BOOL ) Animated {[super viewWillAppear: animated]; // Do not Forget to Call Super (! Self.observingContentOffset) {[self.tableView addObserver: Path to Self: @ "Content Offset" option: NSKeyValueObservingOptionNew Reference: NULL]; self.observingContentOffset = Yes; }} - (zero) viewView size: (BOOL) Animated (Do not forget to make super-viewwhite size: animated) // Super (self.observingContentOffset) {[remove self.tableViewAbbsver: Path to Self: @ "Content Offset"] ; Self.observingContentOffset = no;}}   

The above solution should be solved, I will take this one step further and suggest that you complete this KVO code Think of Retirement as Tableview actually leads to a Scroll View P-squared, when you set the representative of the table view, you are also assigning the representative to the built-in scroll wite, thus, assigning a representative of your table view, also working as a scroll view representative. And you can only apply the relevant method (s) if you need to identify each scroll event, then it may be a more robust tone than kiwi (And also accidentally eliminates your original problem). And if you are only removed from the scene, recognizing the need, iOS 6 provides some relevant high-level methods Make it even easier.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -