-
Notifications
You must be signed in to change notification settings - Fork 1.3k
added blocks for UIImagePickerController #174
Conversation
@jksk could you add some unit tests? |
@segiddins Added unit tests. |
didCancel = YES; | ||
}; | ||
|
||
[_subject.dynamicDelegate imagePickerControllerDidCancel:_subject]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be called on _subject.delegate
Gotcha. I haven't looked through it that carefully, so there might be a good reason why the UIImagePickerController is different from the rest of the UIKit blocks. But just FYI, that's not the pattern that the other UIKit tests follow. The UIActionSheet, UIAlertView and UIWebView tests all call the dynamicDelegate, not the delegate. |
Does this actually work? For some reason (at least in iOS 7), seems that the method swizzling bit is never called because the initial class_addMethod call seems to succeed.
Therefore when using blocks, delegate is not being correctly set. |
|
So how do we workaround that? As it stands the block properties doesn't |
This is one of the problem with Apple's internal inconsistencies. I suggest using an |
Why not swizzle the method without using class_addMethod first? Problem with class_addMethod is that it overrides implementation in super class causing the breakage. |
That's not a practice we can apply generally. Lots of private Apple subclasses of UIKit things do that (i.e., "self.delegate = self;" and doing so in BlocksKit heavily broke them. |
Any progress since then? I need it badly. :/ |
BlocksKit support for UIImagePickerController.