Crashlytics给我这个错误在我的应用程序:试图解雇UIAlertController的iOS 8
Fatal Exception: NSInternalInconsistencyException
Trying to dismiss UIAlertController <UIAlertController: 0x14de40020> with unknown presenter.
UIKit
-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 584
此问题仅出现在iOS 8的,但是当我试图重现这个错误,我alertViews
iOS中8和没有正常工作坏事发生。为什么会出现这个问题?
我已经阅读,在iOS 8 UIAlertView
已被弃用,现在,我们不得不使用UIAlertController
,但是当我尝试使用UIAlertController我不能解雇警报和功能是不一样的。
请帮帮我。
谢谢您的提前。
编辑:
我想改变的代码是这样的:
UIAlertView * alerta = [[UIAlertView alloc] initWithTitle: AMLocalizedString(@"alertUpdate", @"")
message:@"\n"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.center = CGPointMake(139.5, 75.5); // .5 so it doesn't blur
[alerta addSubview:spinner];
[spinner startAnimating];
[alerta show];
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:dis bundle:nil];
MainVC *main = [storyBoard instantiateViewControllerWithIdentifier:@"MainVC"];
UINavigationController *navControl = [[UINavigationController alloc] initWithRootViewController: main];
[self presentModalViewController: navControl animated: YES];
[alerta dismissWithClickedButtonIndex:0 animated:YES];
需要添加一个动作? – amurcia 2014-10-30 11:37:18
这对我不起作用。当警报显示时,我更改了视图控制器并返回到mainVC。当我推送你的代码时,警报出现,但我无法推送de mainVC。 – amurcia 2014-10-30 11:41:09