UIAlertView的私有方法导致崩溃

3
我看到我的一个应用程序出现了奇怪的崩溃,似乎是由UIAlertView的一个私有方法引起的。我进行了一些搜索,发现其他一些参考资料也提到此方法涉及到类似的崩溃,例如这里,但我不确定原因是否相同。为了确保,我总是在委托被释放时将UIAlertView委托设置为nil。
堆栈跟踪如下:
Exception Type:  SIGABRT
Exception Codes: #0 at 0x351ce32c
Crashed Thread:  0

Thread 0 Crashed:
0   libsystem_kernel.dylib              0x351ce32c __pthread_kill + 8
1   libsystem_c.dylib                   0x370c329f abort + 95
2   eLogbook                            0x000bbacd -[GetOperationPartsDictionary init] (GetOperationPartsDictionary.m:22)
3   UIKit                               0x32557f93 -[UIAlertView(Private) _popoutAnimationDidStop:finished:] + 855
4   UIKit                               0x3240dc53 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 471
5   UIKit                               0x3241357d -[UIViewAnimationState animationDidStop:finished:] + 53
6   QuartzCore                          0x36eeac2f CA::Layer::run_animation_callbacks(void*) + 203
7   libdispatch.dylib                   0x3140ae91 _dispatch_main_queue_callback_4CF$VARIANT$up + 197
8   CoreFoundation                      0x353ad2ad __CFRunLoopRun + 1269
9   CoreFoundation                      0x353304a5 CFRunLoopRunSpecific + 301
10  CoreFoundation                      0x3533036d CFRunLoopRunInMode + 105
11  GraphicsServices                    0x3662c439 GSEventRunModal + 137
12  UIKit                               0x32426e7d UIApplicationMain + 1081
13  eLogbook                            0x0007767f main (main.m:14)

关于这个问题,让我真正困惑的是-[UIAlertView(Private) _popoutAnimationDidStop:finished:]方法似乎调用了我的GetOperationPartsDictionary类的init方法。从用户提供的有限信息来看,这个崩溃发生在启动时,此时该类还没有被加载。
我正在使用QuincyKit将崩溃报告发送到服务器,然后使用标准的symbolicatecrash脚本进行符号化。用于符号化崩溃的Xcode版本与构建二进制文件时使用的版本相同,并且我确信用于符号化崩溃的dSYM是正确的 - 例如,我的代码行号是正确的。
有人对此有什么想法吗?
编辑:应该补充说明,这在一个现场使用的应用程序中发生,但只会偶尔出现。它可能影响大约1000个用户中的1或2个,但我从未能够在设备上或模拟器中重现它。

请查看我的以前的问题,跟踪sigabrt错误。特别是阅读答案后的评论,使用断点捕获任何异常。https://dev59.com/p2sz5IYBdhLWcg3wLUt2 - owen gerig
谢谢,但我应该提到我无法在模拟器或设备上重现这个问题,我只是修改了原始问题。因此断点不会有帮助 :( - yod
请发布一些代码,以便我们能够帮助您。 - Parth Bhatt
1个回答

0

看起来您在警告框已被释放后调用了UIAlertViewDelegate。

只需在dealloc方法中释放它,像这样:

-(void)dealloc {
    self.alertView.delegate = nil; //setting delegate to nil
    self.alertView = nil; //if you have defined alert as property
    //other release statements of your controller
    [super dealloc];
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接