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.
[self performSelector:@selector(debug) withObject:nil afterDelay:0.1];
. Can you do a[self performSelectorOnMainThread:withObject:waitUntilDone
instead? I am not on my MAC and I wonder if its because the view is set on possibly a background thread – Blubber-performSelector:
performs its selector on the same thread it has been called. Also this is just an 'optimization' to reproduce the bug, in my real application the views are replaced as a response to a user action which obviously happens on the main thread, – Chaplain[TableView release]: message sent to deallocated instance
. – LassitudetableView
that is created, although it is deallocated. I do not know why this happens - it might as well be a bug with the accessibility inspector. Something else - why do you want to create different instances oftableView
instead of just creating it once and reusing it? If you reuse thetableView
you won't get that error. – Lassitudeself
or a separate class. – Lassitude