Giter Club home page Giter Club logo

Comments (9)

grp avatar grp commented on July 2, 2024

Not nearly enough detail. Closed for now.

from pulltorefreshview.

JmeHsieh avatar JmeHsieh commented on July 2, 2024

Just try to use your PullToRefreshView in viewDidLoad, and set to nil in viewDidUnload. Since PullToRefreshView is added as a observer of scrollView, while receiving memory warning, the scrollView is now being released. However, PullToRefreshView is still an observer of scrollView, which was just been released, now the app crash. This is the "Big Issue" that I can't release PullToRefreshView in viewDidUnload since the statements above.

from pulltorefreshview.

maddox avatar maddox commented on July 2, 2024

This is confirmed. Except it's 2 different issues.

I don't see it in the code, but somehow, the delegate is being retained. This is what causes the crash.

Setting the pullToRefreshView's delegate to nil before nillng out the pullToRefreshView does in fact prevent a crasher. But the issue with the observer is still present.

Here is the warning:

2012-01-27 22:02:02.317 GHTeam[10054:15803] Received memory warning.
2012-01-27 22:02:02.318 GHTeam[10054:15803] An instance 0x904a800 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 0xa891080> (
<NSKeyValueObservance 0xa890d00: Observer: 0xa890ef0, Key path: contentOffset, Options: <New: 
YES, Old: NO, Prior: NO> Context: 0x0, Property: 0xa891100>
)

from pulltorefreshview.

maddox avatar maddox commented on July 2, 2024

Actually, I don't think that resolved the crasher either.

from pulltorefreshview.

maddox avatar maddox commented on July 2, 2024

hwhoops. Didn't see this:

- (void)containingViewDidUnload;

Call this in viewDidUnload and dealloc and you're good to go.

from pulltorefreshview.

drewish avatar drewish commented on July 2, 2024

This seems like it's still an open issue right?

from pulltorefreshview.

grp avatar grp commented on July 2, 2024

I'm still not sure I understand. If you release your scroll view in -viewDidUnload, you should just release the pull to refresh view as well. Then it will remove its KVO context, and everything will be fine?

from pulltorefreshview.

grp avatar grp commented on July 2, 2024

Looks like I don't remember my own code. :) I'll take a look at this when I get a chance.

from pulltorefreshview.

cbowns avatar cbowns commented on July 2, 2024

@maddox has the right approach. I put in containingViewDidUnload as a safe way to break the KVO/view retain cycle here. It’s what Batch used to safely release the view.

from pulltorefreshview.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.