Hi,
Got crash here when i put nil block inside your method:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
void (^block)(NSUInteger buttonIndex, UIAlertView *alertView) = objc_getAssociatedObject(self, "blockCallback");
block(buttonIndex, self); //crash
}
It should be like that:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
void (^block)(NSUInteger buttonIndex, UIAlertView *alertView) = objc_getAssociatedObject(self, "blockCallback");
if (block) block(buttonIndex, self); //work's great now !
}
It's really nice extension, but you should always check block exists before calling it.
Hi,
Got crash here when i put nil block inside your method:
void (^block)(NSUInteger buttonIndex, UIAlertView *alertView) = objc_getAssociatedObject(self, "blockCallback");
block(buttonIndex, self); //crash
}
It should be like that:
void (^block)(NSUInteger buttonIndex, UIAlertView *alertView) = objc_getAssociatedObject(self, "blockCallback");
if (block) block(buttonIndex, self); //work's great now !
}
It's really nice extension, but you should always check block exists before calling it.