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