iOS VoiceOver 崩溃(消息发送到解除分配的实例)

标签 ios objective-c uitableview accessibility voiceover

在启用 VoiceOver 的情况下运行我的应用程序时,我遇到了奇怪的崩溃。该应用程序有一个侧边栏界面(如 Facebook)。当点击侧边栏 UITableView 中的一个 UITableViewCell 时,我换掉了 View Controller (根据点击的单元格创建一个新的并释放旧的) .

虽然启用了 VoiceOver,但我有时在点击单元格时会崩溃。这种崩溃不会每次都发生(大约每两到三次尝试一次)并且这不是导致崩溃的唯一原因(但在我的测试中它是触发它的主要因素)。

请记住,此崩溃在启用 VoiceOver 时发生。

当崩溃发生时,我通常会在控制台中看到这一行。

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

但我也见过

* 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.

因此我启用了 NSZombies 并在 Instruments 中运行该应用程序。我的任何代码都没有触及对象引用。 Instruments running NSZombies

我也尝试在调试器之外运行时获取崩溃日志,但不幸的是 Xcode 无法符号化它们。

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

崩溃发生在 iOS 6 和 7 上。我也尝试从整个应用程序中删除所有辅助功能调用,但应用程序仍然崩溃。

整个星期我都在努力弄清楚这个问题,但我觉得我离这个问题还差得很远。关于从这里开始的任何想法?

最佳答案

我有同样的错误。我删除了可访问性方法以消除错误。 我们需要重写一些可访问性方法以支持 iOS 6 中的旁白阅读顺序

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

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

如果您的代码根据我的上述方法崩溃。尝试删除这些方法并检查。我观察到的一件事是在删除上述方法后,Voiceover 将不会按顺序读取元素。它将以其他(随机)顺序阅读。

希望这能解决您的崩溃问题。

关于iOS VoiceOver 崩溃(消息发送到解除分配的实例),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21436807/

相关文章:

iphone - 有没有办法让应用程序在装有 iOS 7 的 iPhone 上运行并显示为 ios 6?

ios - UITableView 部分重复数据

iphone - iOS - 缩放和裁剪 CMSampleBufferRef/CVImageBufferRef

ios - 在WatchOS上使用AVAudioEngine录音时禁止播放

ios - 在同一行上并排显示UITableViewCell(与“联系人”->“信息”中一样)

objective-c - 如何制作一个出现在全屏窗口顶部的 Cocoa 窗口?

iphone - 在 iPad 上自动调整大小

ios - UNCalendarNotificationTrigger 每小时触发器返回错误的触发日期

ios - Respoke api认证错误

objective-c - 在运行时删除框架公共(public) header