Switching between multiple UITableViews using VoiceOver crashes
I have it UIViewController
with the following view hierarchy:
UIView (root of UIViewController)
|__________
| |
UITableView(A) UIView (overlay view)
____|_______
| |
UITableView(B) UITableView(C)
None of UITableViews
them are displayed at the same time - I just switch between them for different reasons: one for normal elements, one used to find results, etc.
I get this crash somewhat sequentially by enabling VoiceOver
, calling UITableView
B, dismissing it, and then traversing the 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
Crash error:
[UITableTextAccessibilityElement accessibilityContainer] message sent to deallocated instance
I am working on iOS
8.1.2.
Obviously this has to do with VoiceOver
, or rather, the path is UIAccessibility
traversing through its accessibility items, trying to access the freed object. I've tried posting availability notifications like UIAccessibilityScreenChangedNotification
and UIAccessibilityLayoutChangedNotification
after hiding and showing UITableView
so I accessibility
know the screen has changed, but no luck.
My UITableView
A and C also have some extra sub-queries used as update / load more controls, but even removing them doesn't help.
Update: I also get these warnings when using VoiceOver
to connect to UITextField
which is a subzone of property UITableView
(a) headerView
:
**** 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?
source to share
I had a similar problem in my project. After a few hours of debugging, I found that the problem was. It turns out that VoiceOver crashed due to some empty (empty, as well as no labels / images / etc.) cells in the table view (I use empty cells as additional spacers around the selected cell in a specific section). After I removed the accessibility items in those cells, the crash also disappeared ... maybe this helps in your case as well.
- (NSInteger)accessibilityElementCount {
return 0;
}
- (NSArray *)accessibilityElements {
return nil;
}
source to share