-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Use of super in categories #116
Comments
This is a valid fear. The actual behavior of the call has depended on the compiler at times. In the future I suppose I'll use the runtime to get the actual/real/current super-interface and attach the BlocksKit one via swizzling. Swizzling isn't actually that scary if you're careful and make sure to call the original. |
After looking at this closely, this concerns me deeply too, and makes me distrustful of using BlocksKit for a production application. In particular, the documentation in
By overriding this method in a category and calling super directly on I'd like to request that with or without swizzling this feature be included as optionally compiled. If issues with other libraries arise, a simple |
Looking into it. |
You can do it without method swizzling: http://www.cocoawithlove.com/2008/03/supersequent-implementation.html |
|
Okay. Interesting information. It might not be suitable in that case to |
This seems only to be an issue as the you're not really 100% certain that the default implementation doesn't do anything. Right? I mean if the documentation outright said that the default implementation doesn't do jack, then it wouldn't be a concern? |
@seivan The documentation for |
@Pretz Yes, I know. I didn't mean this particular instance specifically, just asking generally :-) I am just talking general here, if the documentation outright says that the default implementation does nothing then it would be OK to do this, instead of hijacking the original message call, or is that a gray area? I'm mostly referencing @a2's comment |
In the era of |
Are you suggesting to retire the touch blocks from UIView and to rely on UIGestureRecognizer? |
My intent is to get rid of |
Why wasn't this included in the 1.8.3 release? i really need it. |
It will be included in the 2.0.0 release. All in good time. |
I'm pretty concerned by the use of:
In the
UIView (BlocksKit)
category. Just making sure everyone's aware that because this is in a category,super
will send the message toUIView
's superclass:UIResponder
, and not to the original implementation ofUIView
's-touchesBegan:withEvent:
. This is a problem becauseUIView
might be doing important stuff in its-touchesBegan:withEvent:
that could get completely bypassed by your implementation!I'm actually surprised clang doesn't freak out with a Category is implementing a method which will also be implemented by its primary class warning - I guess it's because it's
UIResponder
that implements the original method...In order to invoke the original implementation of
-touchesBegan:withEvent:
, you need to use Method Swizzling which has its own huge set of problems (not the least of which is the unpredictability when used with other libraries).I bring this up because I'm getting an unpredictable, random crash in my current application under iOS 6 in the simulator, where upon touching a UI element that results in a navigation controller push/pop, the runtime will inexplicably crash sometime shortly after in the same runloop cycle with a
__sel_registerName
EXC_BAD_ACCESS. I can't prove that it's definitely BlocksKit right now, but when I unlink BlocksKit, I no longer see the issue. It only happens under very specific conditions and it's very difficult to replicate reliably.Can someone tell me if I'm way off base here?
The text was updated successfully, but these errors were encountered: