导航回来并按下UIAlertview按钮时应用程序崩溃

时间:2015-08-21 07:54:30

标签: ios objective-c memory-management crash uiresponder

我有自己的聊天窗口,类似于Apple Messaging屏幕。有一种情况是我在群聊中聊天,群组所有者从其他设备中删除该群组。在这种情况下我做的是删除所有消息并显示[self.navigationController popToRootViewControllerAnimated:YES];并在下一行显示这样的警报视图

 UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Group deleted"  message:@"The group is deleted" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];

现在,当我导航回rootViewController并按下UIAlertview中的确定然后应用程序崩溃时,控制台[ResponderView _responderWindow]: message sent to deallocated instance 0x16312440和配置文件僵尸工具{ {1}}(僵尸)在地址:0x18a89aa0`并且回溯是这样的事情

An Objective-C message was sent to a deallocated 'ResponderView' object

如果键盘关闭然后我thread #1: tid = 0x1aa279, 0x2abf5272 CoreFoundation`___forwarding___ + 534, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe) * frame #0: 0x2abf5272 CoreFoundation`___forwarding___ + 534 frame #1: 0x2ab24e78 CoreFoundation`_CF_forwarding_prep_0 + 24 frame #2: 0x2e26a728 UIKit`-[UIView(Internal) _firstResponder] + 20 frame #3: 0x2e26a708 UIKit`-[UIResponder isFirstResponder] + 24 frame #4: 0x2e9075a8 UIKit`-[UITextView _keyboardDidShow:] + 24 frame #5: 0x2aba9e08 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 frame #6: 0x2ab04514 CoreFoundation`_CFXNotificationPost + 1784 frame #7: 0x2b866748 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 72 frame #8: 0x2e8d4706 UIKit`-[UIInputWindowController postEndNotifications:withInfo:] + 554 frame #9: 0x2e8d55dc UIKit`-[UIInputWindowController mergeTransitionIfNecessaryWithTransition:] + 244 frame #10: 0x2e8d575c UIKit`-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] + 92 frame #11: 0x2e8d9410 UIKit`-[UIInputWindowController setPlacement:starting:completion:] + 48 frame #12: 0x2e8d9004 UIKit`-[UIInputWindowController setInputViewSet:] + 624 frame #13: 0x2e8d54ce UIKit`-[UIInputWindowController performOperations:withAnimationStyle:] + 38 frame #14: 0x2e324f40 UIKit`-[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 1012 frame #15: 0x2e341b86 UIKit`-[UIPeripheralHost(UIKitInternal) _restoreInputViewsWithId:animated:] + 590 frame #16: 0x2e604b6e UIKit`-[UIAlertController _restoreInputViewsAnimated:] + 114 frame #17: 0x2e60496c UIKit`-[UIAlertController viewDidDisappear:] + 76 frame #18: 0x2e2846c0 UIKit`-[UIViewController _setViewAppearState:isAnimating:] + 364 frame #19: 0x2e284c12 UIKit`-[UIViewController _endAppearanceTransition:] + 290 frame #20: 0x2e543eb2 UIKit`-[UIPresentationController transitionDidFinish:] + 862 frame #21: 0x2e546172 UIKit`__56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 150 frame #22: 0x2e37f31e UIKit`-[_UIViewControllerTransitionContext completeTransition:] + 102 frame #23: 0x2e2a2cc0 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 308 frame #24: 0x2e2a28dc UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184 frame #25: 0x2e2a27ee UIKit`-[UIViewAnimationState animationDidStop:finished:] + 66 frame #26: 0x2dc86960 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 236 frame #27: 0x0150915e libdispatch.dylib`_dispatch_client_callout + 22 frame #28: 0x0150ce44 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1512 frame #29: 0x2abb7608 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8 frame #30: 0x2abb5d08 CoreFoundation`__CFRunLoopRun + 1512 frame #31: 0x2ab02200 CoreFoundation`CFRunLoopRunSpecific + 476 frame #32: 0x2ab02012 CoreFoundation`CFRunLoopRunInMode + 106 frame #33: 0x325d3200 GraphicsServices`GSEventRunModal + 136 frame #34: 0x2e2cea08 UIKit`UIApplicationMain + 1440 frame #35: 0x000faeec JonglaIM`main(argc=9, argv=0x0129e9b4) + 108 at main.m:16 然后点击popToRootViewController UIAlertBox按钮

,则不会发生这种情况

1 个答案:

答案 0 :(得分:0)

您是否曾尝试以编程方式隐藏键盘?可能是键盘问题,我认为警报会将键盘保持在屏幕上,通常情况下它应该被隐藏。