Question

I am getting a weird crash when running my app with VoiceOver enabled. The app has a sidebar interface (like Facebook). When tapping on one of the UITableViewCells in the sidebar UITableView, I swap out the view controller (create a new one based on which cell was tapped and deallocate the old one).

While VoiceOver is enabled, I sometimes get a crash when I tap the cell. This crash does not occur every time (it is about once every two or three tries) and this is not the only thing that causes the crash (but in my testing it is the main thing that triggers it).

Keep in mind this crash only happens then VoiceOver is enabled.

I usually get this line in the console when the crash occurs.

*** -[UITableTextAccessibilityElement setAccessibilityLabel:]: message sent to deallocated instance 0x1fdaec10

but I have also seen

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 6 beyond bounds [0 .. 4]' Note then I see the NSRangeException with exception breakpoints enabled, it does not point me to a place in my code where the error occured.

So I enabled NSZombies and ran the app in Instruments. The object references was never touched by any of my code. Instruments running NSZombies

I also tried getting a crash log when running outside of the debugger, but unfortunatly Xcode was not able to symbolicate them.

Last Exception Backtrace:

0 CoreFoundation 0x2e3c3f46 __exceptionPreprocess + 126

1 libobjc.A.dylib 0x387536aa objc_exception_throw + 34

2 CoreFoundation 0x2e2fa52e -[__NSArrayM objectAtIndex:] + 226

3 APP-NAME 0x000e3726 0x46000 + 644902

4 UIKit 0x0250462e 0x24c6000 + 255534

5 UIAccessibility 0x35c029f8 -[NSObject(AXPrivCategory) accessibilityElementCount] + 16

6 UIAccessibility 0x35bfe66a _appendChildrenToArrayStartingAtIndexWithChildren + 318

7 UIAccessibility 0x35bfe51e _appendChildrenToArrayStartingAtIndex + 86

8 UIAccessibility 0x35bfe460 _addAXElementsToArrayFromObject + 1580

9 UIAccessibility 0x35bfddfc _appendVendedAXElementsFromUIElements + 156

10 UIAccessibility 0x35bfdbfe _createAXUIElementsFromUIElements + 126

11 UIAccessibility 0x35bfc218 _copyParameterizedAttributeValueCallback + 152

12 AXRuntime 0x3152395c _AXXMIGCopyParameterizedAttributeValue + 168

13 AXRuntime 0x3152084e _XCopyParameterizedAttributeValue + 438

14 AXRuntime 0x31528158 mshMIGPerform + 184

15 CoreFoundation 0x2e38e9da CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 30

16 CoreFoundation 0x2e38e976 __CFRunLoopDoSource1 + 342

17 CoreFoundation 0x2e38d14a __CFRunLoopRun + 1394

18 CoreFoundation 0x2e2f7c22 CFRunLoopRunSpecific + 518

19 CoreFoundation 0x2e2f7a06 CFRunLoopRunInMode + 102

20 GraphicsServices 0x32fd627e GSEventRunModal + 134

21 UIKit 0x30b9b044 UIApplicationMain + 1132

22 APP-NAME 0x000509e2 0x46000 + 43490

23 libdyld.dylib 0x38c5bab2 tlv_initializer + 2

The crash occurs on iOS 6 and 7. I also tried removing every accessibility call from the entire app, but the app was still crashing.

I have been trying to figure this out all week and do not feel like I am getting any closer. Any ideas on where to proceed from here?

Was it helpful?

Solution 2

We were able to find the problem by debugging on iOS 6 instead of 7.

In iOS 6,

AX ERROR: Could not find my mock parent, most likely I am stale.

was showing up in the console. That combined with the UITableViewCell error mentioned about, we dug through all of the table code in the sidebar.

We found that we were using reusable UITableViewCells as header views, and that was causing the zombie issue that we were seeing.

So bottom line, don't use UITableViewCells as UITableView header/footer view.

OTHER TIPS

I had the same error. I removed the accessibility methods to get rid of tis error. We need to overwrite few accessibility methods to support reading order by voiceover in iOS 6

- (id)accessibilityElementAtIndex:(NSInteger)index
{
    return [[self accessibleElements] objectAtIndex:index];
}

- (NSInteger)indexOfAccessibilityElement:(id)element
{
    return [[self accessibleElements] indexOfObject:element];
}

If your code is crashing based on the above methods I feel. Try to remove those methods and check. One thing I observed is after removing the above methods Voiceover will not read the elements in order. It will read in some other(random) order.

Hope this will fix your crash.

You can get this crash if you try to manually focus accessibility on to a UITableViewCell instead of a particular item inside the cell. If your requirement is to treat the tableCell as a whole as an accessibility element then in addition to specifying accessibility label and trait for the cell forget not to set isAccessibilityElement = YES for the cell. If isAccessibilityElement = YES then the iOS will not attempt to call [UITableTextAccessibilityElement setAccessibilityLabel:]method which causes the crash because it knows that tableCell itself is an accessibility element and will not try to examine what is inside the cell.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top