-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Hits KVO exception breakpoint every time #285
Comments
this exception is caught and handled. what we need is a way to ask if a key-value observer has been previously added, but that does not exist in the API. :( |
I'd like to request that this be reopened. Leaving the Objective-C Exception Breakpoint turned on by default is extremely useful for debugging. Is it possible to use KVOController to handle the automatic addition and removal of observers for the view controller, or possibly to balance these calls so that an observer is never removed twice? I'm happy to submit a patch if you're amenable to it. |
I agree. It is really annoying when exception breakpoint is enabled. |
@khanlou / @RishabhTayal 👍 re-opened. |
Awesome. Let me know if you want me to write a patch and pull request it. |
@khanlou - please do! |
fixed in PR #304 |
I am still seeing the issue in version 5.0.4, am I missing something? |
The issue is still there. :( |
@rnaud it was rolled back due to some inconsistencies. i haven't had a chance to fix them yet, not sure if i will get a chance |
because of how view{Will/Did}(Appear/Disappear} in iOS 7 with there are lots of edge cases, and when i was writing this i could not find a good way to implement balanced calls to add/remove observers. this is a major deficiency in Apple's API -- the lack of ability to check if an observer has already been added or not. 😢 |
This is more of an annoyance than a bug anyway, the lib is great. |
Hi Guys, any news about this issue? It happens all the time, please, any help? |
@jlsuarezs - see my comment above and the discussion in the PR itself. |
Hi Jesse!!, I have read it, but that means we can not use the latest version of your component? |
@jlsuarezs - i don't understand. why do you think you can't use it? |
@jessesquires Do you think this would solve the issue? |
@RishabhTayal - I've been thinking about that! When I have a chance, I'll try it out. |
@jessesquires I have created a pull request which fixes this issue. Please review the code and accept it. |
@RishabhTayal - when i have time! |
How about all of us chip in and donate to Jesse to both thank him and incentivize him :) |
Why not just create a bool ivar that tracks when the KVO observer has been installed? Use the ivar to determine whether or not to remove the observer. That's the simple fix I've put in place for myself. I'm not proficient at pull requests, so I can't provide one. In JSQMessagesInputToolbar.m & JSQMessagesViewController.m, I added
In jsq_addObservers, check that isObserving is NO before proceeding, and set isObserving to YES once the observers are installed. Similarly in jsq_removeObservers, check that isObserving is YES before proceeding, and set isObserving to NO once the observers have been removed. |
@markkrenek - excellent suggestion! |
I would also like to see this issue resolved either with KVOController or with the bool ivar (if it works) |
@chrisballinger - planned for the next release 👍 |
Awesome! :) On Wednesday, July 16, 2014, Jesse Squires notifications@github.com wrote:
|
This is still an issue for me. It only happens the first time I load my chat view, and it still happens on line 155. I just re-downloaded the entire library and replaced my files just to be sure, but it still happens :/ |
@mbcoder17 - i can't repro. is anyone else still seeing this issue? |
My app is managed by a tab controller, this wouldn't have something to do with the issue, would it? It's weird that it only happens after I build from xcode. After that it doesn't happen, but when I build again it does, only the first time... |
@jessesquires I also want to add that line 155 is empty lol, could it be hitting a breakpoint or something? |
I have a Exception breakpoint in my project. The breakpoint hits line 155 in JSQMessagesInputToolbar everytime. Method name is 'jsq_removeObservers'.
Not a big issue, but it would be better to know the solution to avoid this.
Thanks.
The text was updated successfully, but these errors were encountered: