Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KVC in UITableView subclass causing crash with accessibility enabled

I have a custom UITableView subclass in which I override +accessInstanceVariablesDirectly to return NO in order to ensure attributes with no setter cannot be set using KVC.

When removing this table view from the view hierarchy, the app crashes - sometimes - and now for the weird part: only if Accessibility is enabled! (i.e. the Accessibility Inspector is visible, or you have Accessibility enabled on a physical device)

If I do not override +accessInstanceVariablesDirectly, everything works fine. I figured maybe UITableView relies on accessing some instance variables directly - but then what is the point of this method, if I can break superclasses by using it? Is there a way to specify this behavior per-attribute, like +automaticallyNotifiesObserversForKey:? However I am baffled by the fact that this issue only exists when Accessibility is enabled.

I tried analyzing the project with various Instruments, but without success.

You can find a minimal project reproducing the issue here. I would greatly appreciate any pointers on why this is happening or how to achieve what I want nonetheless.

like image 992
Christian Schnorr Avatar asked Jun 03 '15 23:06

Christian Schnorr


1 Answers

This issue appears to be fixed in iOS 9.

like image 196
Christian Schnorr Avatar answered Nov 15 '22 15:11

Christian Schnorr