UIAlertView-Blocks icon indicating copy to clipboard operation
UIAlertView-Blocks copied to clipboard

Default `tapBlock` no longer works with iOS 10, issue not detected by Xcode

Open bengotow opened this issue 9 years ago • 1 comments

When you use the standard UIAlertView+Blocks API to provide a tapBlock, it is called when - alertView:clickedButtonAtIndex: is fired. This API was deprecated in iOS 9, and choosing iOS 10 as a Base SDK causes it to never be executed, meaning that your tapBlock is never run.

This issue isn't picked up by Xcode during compilation because the UIAlertView (Blocks) category isn't explicitly declared as a UIAlertViewDelegate. (I'm not sure this is possible, though.) Unfortunately this means I shipped an app update this month with a handful of unreachable tapBlocks.

The quickest solution is to pass NULL as the tapBlock when instantiating, and then separately set the setDidDismissBlock:, which does still fire in iOS 10.

bengotow avatar Oct 13 '16 06:10 bengotow

Thanks for letting me know, i'll try and look into it asap and apologies for the inconvenience caused. I've migrated my code to UIAlertController so hadn't came across this

ryanmaxwell avatar Oct 13 '16 20:10 ryanmaxwell