Я ничего не делаю в методе отмены делегирования. Мне нужна помощь.Я использовал uialertview в iOS8, но приложение потерпело крах после того, как я дважды нажал кнопку «Отмена»
Мой код:
- (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
...... (код слишком много, я не могу отправить их всех.)
Пожалуйста, пост здесь ваш код, отображающий alertview и clickedButtonAtIndex: (NSInteger) buttonIndex метод –
Я сделал это, вы можете мне помочь? Спасибо. – hxbtec
Как вы можете нажать кнопку CancelButton Twice, при первом нажатии на кнопку alertView следует отклонить. –