domesticcatsoftware/DCIntrospect — Issue #38: The ApplicationAccessibilityEnabled hack may turn out to be a very bad idea
Author: 0xced
Created: 2011-12-30 20:21:00+00:00
State: open

It seems that the hack enabling accessibility without the accessibility inspector in the simulator have very bad unintended side effects.

Setting the `ApplicationAccessibilityEnabled` preference to `true` in `~/Library/Application Support/iPhone Simulator/5.0/Library/Preferences/com.apple.Accessibility.plist` will change the behavior of `UITableView` instances in a very unexpected way.

The data source method `- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;` and the delegate method `- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;` will be called for **all** index paths, even for cells which are not visible when the app is totally idle! Deleting the `ApplicationAccessibilityEnabled` preference restores the expected behavior of `UITableView`.

Here are the relevant backtraces.

```
#0 -[TableViewController tableView:cellForRowAtIndexPath:] ()
#1 0x00444e0f in -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] ()
#2 0x004455d6 in -[UITableView(UITableViewInternal) _createPreparedCellForRowAtIndexPath:] ()
#3 0x0c96c0ad in -[UITableViewAccessibility(Accessibility) accessibilityCellForRowAtIndexPath:] ()
#4 0x0c97f60b in -[UITableViewCellAccessibilityElement tableViewCell] ()
#5 0x0c98012a in -[UITableViewCellAccessibilityElement isAccessibilityElement] ()
#6 0x0b774e24 in _appendChildrenToArrayStartingAtIndex ()
#7 0x0b774d3d in _addAXElementsToArrayFromObject ()
#8 0x0b774851 in _appendVendedAXElementsFromUIElements ()
#9 0x0b774774 in _createAXUIElementsFromUIElements ()
#10 0x0b773258 in _copyParameterizedAttributeValueCallback ()
#11 0x0b7aeea6 in _AXXMIGCopyParameterizedAttributeValue ()
#12 0x0b7a9853 in _XCopyParameterizedAttributeValue ()
#13 0x0b7b1e66 in mshMIGPerform ()
#14 0x014e61c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#15 0x0144b022 in __CFRunLoopDoSource1 ()
#16 0x0144990a in __CFRunLoopRun ()
#17 0x01448db4 in CFRunLoopRunSpecific ()
#18 0x01448ccb in CFRunLoopRunInMode ()
#19 0x01c07879 in GSEventRunModal ()
#20 0x01c0793e in GSEventRun ()
#21 0x003aba9b in UIApplicationMain ()
```
```
#0 -[TableViewController tableView:willDisplayCell:forRowAtIndexPath:] ()
#1 0x004454fe in -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] ()
#2 0x004455d6 in -[UITableView(UITableViewInternal) _createPreparedCellForRowAtIndexPath:] ()
#3 0x0c9db0ad in -[UITableViewAccessibility(Accessibility) accessibilityCellForRowAtIndexPath:] ()
#4 0x0c9ee60b in -[UITableViewCellAccessibilityElement tableViewCell] ()
#5 0x0c9ef12a in -[UITableViewCellAccessibilityElement isAccessibilityElement] ()
#6 0x0ca88e24 in _appendChildrenToArrayStartingAtIndex ()
#7 0x0ca88d3d in _addAXElementsToArrayFromObject ()
#8 0x0ca88851 in _appendVendedAXElementsFromUIElements ()
#9 0x0ca88774 in _createAXUIElementsFromUIElements ()
#10 0x0ca87258 in _copyParameterizedAttributeValueCallback ()
#11 0x0cac2ea6 in _AXXMIGCopyParameterizedAttributeValue ()
#12 0x0cabd853 in _XCopyParameterizedAttributeValue ()
#13 0x0cac5e66 in mshMIGPerform ()
#14 0x014e61c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#15 0x0144b022 in __CFRunLoopDoSource1 ()
#16 0x0144990a in __CFRunLoopRun ()
#17 0x01448db4 in CFRunLoopRunSpecific ()
#18 0x01448ccb in CFRunLoopRunInMode ()
#19 0x01c07879 in GSEventRunModal ()
#20 0x01c0793e in GSEventRun ()
#21 0x003aba9b in UIApplicationMain ()
```

Can anybody else confirm this?