Git Product home page Git Product logo

Comments (5)

Tricertops avatar Tricertops commented on June 7, 2024

Yes, that would be great, but I remember I tried doing exactly this. The problem was, I think, that the KVO observances were checked before associated objects were released, which caused error logs to be printed to the console.

Maybe they changed deallocation implementation and it may work correctly now. Could you try it, please? If it works, open a Pull Request. It would be a great improvement.

Thanks.

from block-kvo.

yanjunz avatar yanjunz commented on June 7, 2024

Work for me. I have created a pull request, please check it.

from block-kvo.

Tricertops avatar Tricertops commented on June 7, 2024

Doesn’t work for me. Pull my changes and try adding these two lines to App Delegate in the Example app:

[self.property observeProperty:@"title" withBlock:^(id example, id old, id new) {}];
self.property = nil;

The first line will create an observer and the second will deallocate the Example object, which should remove observers. In my case, it crashed before -dealloc of MTKObserver was called.

from block-kvo.

yanjunz avatar yanjunz commented on June 7, 2024

since MTKObserver is element of a array which is a association object of target, MTKObserver's dealloc will delay to call until next runloop after target is dealloced. So I use deallocBlockExecutor as a helper to notify the related MTKObservers to detach ASAP.
I submit a another pull request. Please review it.

from block-kvo.

Tricertops avatar Tricertops commented on June 7, 2024

Done. It needed swizzling -dealloc, but I already has the implementation in another project.

from block-kvo.

Related Issues (20)

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.