Reputation: 4983
I have a UIViewController
with the following view hierarchy:
UIView (root of UIViewController)
|__________
| |
UITableView(A) UIView (overlay view)
____|_______
| |
UITableView(B) UITableView(C)
None of the UITableViews
are shown simultaneously – I simply switch between them for various reasons: one is for normal items, one is used for searching results, etc.
I'm getting this crash, somewhat consistently, by turning on VoiceOver
, causing UITableView
B to appear, dismissing it, and then navigating through accessibility items in UITableView
A.
Here's the call stack:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x00000001954a7bd0 objc_msgSend + 16
1 UIKit 0x000000018317ea68 -[UITableViewCellAccessibility _accessibilityReuseChildren:forMockParent:] + 496
2 UIKit 0x000000018318f28c -[UITableViewCellAccessibilityElement tableViewCell] + 260
3 UIKit 0x000000018318fcac -[UITableViewCellAccessibilityElement isAccessibilityElement] + 24
4 UIAccessibility 0x0000000191c2c030 _appendChildrenToArrayStartingAtIndexWithChildren + 352
5 UIAccessibility 0x0000000191c2bd04 _addAXElementsToArrayFromObject + 1620
6 UIAccessibility 0x0000000191c2b680 _appendVendedAXElementsFromUIElements + 288
7 UIAccessibility 0x0000000191c2b53c _createAXUIElementsFromUIElements + 160
8 UIAccessibility 0x0000000191c2a3cc _copyParameterizedAttributeValueCallback + 208
9 AXRuntime 0x000000018a5f4a30 _AXXMIGCopyParameterizedAttributeValue + 256
10 AXRuntime 0x000000018a5f0850 _XCopyParameterizedAttributeValue + 412
11 AXRuntime 0x000000018a5fbbc0 mshMIGPerform + 272
12 CoreFoundation 0x0000000184cf6200 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
13 CoreFoundation 0x0000000184cf6160 __CFRunLoopDoSource1 + 436
14 CoreFoundation 0x0000000184cf40e0 __CFRunLoopRun + 1640
15 CoreFoundation 0x0000000184c210a4 CFRunLoopRunSpecific + 396
16 GraphicsServices 0x000000018ddc35a4 GSEventRunModal + 168
17 UIKit 0x00000001895563c0 UIApplicationMain + 1488
18 Stack Exchange 0x000000010018dbe4 main (main.m:16)
19 libdyld.dylib 0x0000000195b02a08 start + 4
The crashing error is:
[UITableTextAccessibilityElement accessibilityContainer] message sent to deallocated instance
I'm running on iOS
8.1.2.
Clearly, this has something to do with VoiceOver
, or rather, the way UIAccessibility
is navigating through its accessibility elements, trying to access a deallocated object. I've tried posting accessibility notifications such as UIAccessibilityScreenChangedNotification
and UIAccessibilityLayoutChangedNotification
after hiding and showing the UITableView
s to let the accessibility
know that the screen has changed, but haven't had any luck.
My UITableView
s A and C also have some extra subviews, used as refresh/load more controls, but even removing these isn't helping.
Update: I am also getting these warnings when using VoiceOver
to tap on a UITextField
which is a subview of UITableView
(a) headerView
property:
**** Accessibility: Could not find a valid index for <SESearchBar: 0x16a03150; frame = (0 0; 320 44); text = ''; layer = <CALayer: 0x16a02fc0>> in -[UITableView indexOfAccessibilityElement:]
|warning| **** Accessibility: Could not find where <SESearchBar: 0x16a03150; frame = (0 0; 320 44); text = ''; layer = <CALayer: 0x16a02fc0>> starts. Was its parent [<UITableView: 0x16208a00; frame = (0 0; 320 504); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x16b4a8c0>; layer = <CALayer: 0x16b49750>; contentOffset: {0, 0}; contentSize: {320, 1800}>] set correctly or did it disappear?
Upvotes: 3
Views: 777
Reputation: 211
I had a similar issue in my project. After a few hours of debugging I found what the issue has been. It turns out that VoiceOver crashed due to some empty (empty as in without any labels/images/etc.) table view cells (I use empty cells as as additional spacing separators around the selected cell in a specific section). After I removed the accessibility elements in those cells the crashes also disappeared... maybe this helps in your case too.
- (NSInteger)accessibilityElementCount {
return 0;
}
- (NSArray *)accessibilityElements {
return nil;
}
Upvotes: 1