【发布时间】:2014-05-27 21:59:36
【问题描述】:
抱歉,我已缩小错误范围,因此它不是 AFNetworking 问题,而是 UI 问题。
我有一个收藏视图。当我点击集合视图时,会显示一个弹出窗口,我可以选择下载一些东西,然后进度条会显示进度。同时,collectionviewcell 也会在其自身上显示另一个进度条。然后我关闭窗口并再次点击单元格,做一些事情然后关闭它。它可能不会在第二次引发异常,当我再次打开和关闭 popOver 时引发异常。
这是来自 lldb 的 bt 跟踪:
* thread #1: tid = 0x1214fc, 0x38592626 libobjc.A.dylib`objc_msgSend + 6, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xb1b8d8b0)
frame #0: 0x38592626 libobjc.A.dylib`objc_msgSend + 6
frame #1: 0x302f7056 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 90
frame #2: 0x302f6ff6 UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
frame #3: 0x302f6fd0 UIKit`-[UIControl sendAction:to:forEvent:] + 44
frame #4: 0x302e2736 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 374
frame #5: 0x302f6a4e UIKit`-[UIControl touchesEnded:withEvent:] + 590
frame #6: 0x302f6720 UIKit`-[UIWindow _sendTouchesForEvent:] + 528
frame #7: 0x302f16ea UIKit`-[UIWindow sendEvent:] + 758
frame #8: 0x302c68ec UIKit`-[UIApplication sendEvent:] + 196
frame #9: 0x302c4f96 UIKit`_UIApplicationHandleEventQueue + 7102
frame #10: 0x2da7125a CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #11: 0x2da7072a CoreFoundation`__CFRunLoopDoSources0 + 206
frame #12: 0x2da6ef1e CoreFoundation`__CFRunLoopRun + 622
frame #13: 0x2d9d9f4e CoreFoundation`CFRunLoopRunSpecific + 522
frame #14: 0x2d9d9d32 CoreFoundation`CFRunLoopRunInMode + 106
frame #15: 0x328d3662 GraphicsServices`GSEventRunModal + 138
frame #16: 0x3032516c UIKit`UIApplicationMain + 1136
* frame #17: 0x0003b12c ChinesePod`main(argc=1, argv=0x27dccd04) + 300 at main.m:39
通过查看跟踪,我不知道出了什么问题。知道我的应用有什么问题吗?
编辑:
当我启用 NSZombie 时,我在控制台中看到了这个错误:
*** -[BlurViewController performSelector:withObject:withObject:]: message sent to deallocated instance 0x166e7df0
BlurViewController 是一个视图控制器,负责显示 PopOver 窗口。这是否意味着 BlurViewController 已被释放?
dismissDialog的源码:
- (void)dismissDialog
{
[UIView animateWithDuration:kAnimationDuration animations:^{
self.view.alpha = 0.f;
self.popUp.transform = CGAffineTransformMakeScale(0, 0);
} completion:^(BOOL finished) {
[self removeFromParentViewController];
[self.view removeFromSuperview];
[self.popUp removeFromSuperview];
if (!self.popUp.isDownloading) {
_popUp = nil;
}
[UIView animateWithDuration:kAnimationDuration animations:^{
_blurView.alpha = 0.f;
} completion:^(BOOL finished) {
[_blurView removeFromSuperview];
}];
}];
}
【问题讨论】:
-
请提供您使用AFNetworking下载的代码。
-
您所指的某些对象已被释放。请发布您的弹出框显示方法的代码。您也可以尝试在启用 NSZombies 的情况下运行
-
@Paulw11 在 Xode 中启用僵尸会有所帮助,但使用带有 Zombies 设置的 Instruments 会好得多...可以查看所有引用计数的递增和递减以及负责的代码,这是每个 iOS 开发人员都必须知道的
-
@RobP,对不起,是的,这就是我的意思。我应该更明确
标签: ios debugging exception crash