Comments (5)
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.
Work for me. I have created a pull request, please check it.
from block-kvo.
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.
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.
Done. It needed swizzling -dealloc
, but I already has the implementation in another project.
from block-kvo.
Related Issues (20)
- Readme.md Is it necessary to remove the observer (like with regular KVO) or not? HOT 8
- Support removing observer for specified keypath
- Not compiling with Xcode 6.3, Swift 1.2 HOT 9
- Compile error when included in .mm file HOT 3
- Can't compile 'objc_msgSend has too many arguments' HOT 9
- Block-KVO logic should follow the same approach as original KVO HOT 1
- Macro MTKObservePropertySelf can not use with stringWithFormat in the block HOT 2
- can you delete "block(self, nil);" HOT 1
- Update deployment_target for cocoa pods HOT 1
- Expose change dictionary for observing collections HOT 2
- Obscure retain issue in -removeAllObservationsOfObject: HOT 10
- Registering change observer without calling block with initial value HOT 3
- Initial value detection HOT 4
- Two-way binding causing infinite loop HOT 2
- Too Many Arguments to Function Call HOT 3
- Update cocoapods version HOT 1
- Want my stuff HOT 2
- PodSpec Version HOT 1
- worth mentioning the use of @keypath in the example
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from block-kvo.