我在取消委托方法中什么都不做。 我需要帮助。
我的代码:
- (void)back{
if(_stateView.stateType == StateType_Failed || _stateView.stateType == StateType_WiFi){
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:[NSString stringWithFormat:@"您确认要放弃连接 %@ 免费热点",_SSID] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:@"不,谢谢", nil];
[alertView show];
return;
}
[self.navigationController popViewControllerAnimated:YES];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 0){
[self.navigationController popViewControllerAnimated:YES];
}
}
我添加了一个断点并获得了崩溃日志和堆栈。
[_UIAlertControllerShimPresenterWindow becomeFirstResponder]: message sent to deallocated instance 0x15e752ec0
(lldb) bt
* thread #1: tid = 0x1c8de, 0x000000018359017c CoreFoundation`___forwarding___ + 968, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x18359017c)
* frame #0: 0x000000018359017c CoreFoundation`___forwarding___ + 968
frame #1: 0x0000000183492ccc CoreFoundation`_CF_forwarding_prep_0 + 92
frame #2: 0x00000001880ac704 UIKit`-[UIPeripheralHost(UIKitInternal) _restoreInputViewsWithId:animated:] + 356
frame #3: 0x00000001883ac834 UIKit`-[UIAlertController _restoreInputViewsAnimated:] + 128
frame #4: 0x00000001883ac5e0 UIKit`-[UIAlertController viewDidDisappear:] + 92
frame #5: 0x0000000187fe3f28 UIKit`-[UIViewController _setViewAppearState:isAnimating:] + 440
frame #6: 0x0000000187fe452c UIKit`-[UIViewController _endAppearanceTransition:] + 344
frame #7: 0x00000001882d2b58 UIKit`-[UIPresentationController transitionDidFinish:] + 984
frame #8: 0x00000001882d512c UIKit`__56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 168
frame #9: 0x00000001880eefd0 UIKit`-[_UIViewControllerTransitionContext completeTransition:] + 132
frame #10: 0x0000000188004774 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 408
...... (代码太多了,我不能全部发布。)
答案 0 :(得分:0)
在throw上添加异常断点并尝试在调试时重现它。并在此处发布一些代码,以便让我们看看错误...
您的UIAlertControllerShimPresenterWindow似乎已经过早解除分配...
答案 1 :(得分:-1)
在显示警报之前,您正在弹出viewcontroller。
从.=~
方法
[self.navigationController popViewControllerAnimated:YES];
为清楚起见。你的代码应该是:
-(void)back