Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

addObserverForKeyPath with 0 as value for option parameter #86

Closed
klaas opened this issue Jul 15, 2012 · 2 comments
Closed

addObserverForKeyPath with 0 as value for option parameter #86

klaas opened this issue Jul 15, 2012 · 2 comments

Comments

@klaas
Copy link

klaas commented Jul 15, 2012

When I call

- (NSString *)addObserverForKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options task:(BKObservationBlock)task

with the options parameter set to 0

I get a bad EXC_BAD_ACCESS failure when the notification should be trigger.

The reason for this is, that

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 

in NSObject+BlockObservation.m

tries to call my block as a BKSenderBlock instead of the given BKObservationBlock.

My reason for writing all this is that I try to find a way to specify an identifier token WITHOUT specifying any NSKeyValueObservingOptions.

My current solution is to pass the value 128 as options. A better solution would be to have the method

- (void)addObserverForKeyPath:(NSString *)keyPath identifier:(NSString *)token task:(BKSenderKeyPathBlock)task;

Any thoughts on this?

BTW, BlocksKit is really great and I don't want to miss it!!

@zwaldowski
Copy link
Collaborator

Hey Klaas, sorry for the trouble. It'll be fixed as soon as I can get to it. Thanks for the report.

@rickrets
Copy link

Thank you Klaas! Had the same issue, but didn't know the 128 solution (for now).

@a2 a2 closed this as completed Oct 6, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants