Crashlytics在我的应用程序中向我发送了这个错误:
Fatal Exception: NSInternalInconsistencyException
Trying to dismiss UIAlertController <UIAlertController: 0x14de40020> with unknown presenter.
UIKit
-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 584
这个问题只会在iOS 8中出现,但是当我尝试复制这个错误时,在iOS 8中我的
alertViews
能够正常工作,没有发生任何不良情况。为什么会出现这个问题?我已经了解到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];