UIAlertView-Blocks
UIAlertView-Blocks copied to clipboard
Blocks are not working
Hi
If you use other cocoaPods , (e.g : TapjoySDK) beside UIAlertView+Blocks the blocks are not returning.
Hi - I've used this pod with other pods many times - Perhaps this is a case of category collision? The TapjoySDK is closed-source, so I can't tell if they are doing anything to UIAlertView, but it seems to be problem when using this pod in conjunction with TapJoy. If I find a workaround i'll post it here.
Yeah, i thought it's not necessarily the problem with your pod but i wanted you to know. Thanks for the answer.
I have the same problem. Just wonder if there is any workaround available. I have been changing the category name and method name. but no luck
@macinux are you using the same library (TapJoy) or is another incompatibility?
yes. same library (TapJoy). thanks
Unfortunately i had to use TapJoy library so i stopped using this category. My solution was to set my block as a property and called that from clickedButtonAtIndex.
typedef void (^TapBlock) (); @property (nonatomic, copy) TapBlock savedTapBlock;
-
(void)showAlertWithBlock:(TapBlock)block { self.savedTapBlock = block; // Show alertView }
-
(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { // ... if (_savedTapBlock) { _savedTapBlock(); }
// ... }
Thanks @DavidHorvath for sharing your solution. It would be good to find a permanent workaround
The bug also repeated to me. After adding the lib: Tapjoy
They should call it Tapsad.
This is a category name collision. If you just change to (Blocks2)
for example, it will work.