UIAlertController代码上的EXC_BAD_ACCESS = 1

我有一个视图控制器,我点击按钮启动UIAlertController 。 以下是我的代码:

 - (IBAction)playOnlineURL:(UIButton *)sender { [self launchPlayURLAlert]; } - (void) launchPlayURLAlert{ NSString *defaultURLString = @“MY URL”; UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"Play Online URL" message: @"Enter the URL" preferredStyle:UIAlertControllerStyleAlert]; [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.placeholder = @"Enter URL"; textField.text = defaultURLString; textField.textColor = [UIColor blueColor]; textField.clearButtonMode = UITextFieldViewModeWhileEditing; textField.borderStyle = UITextBorderStyleRoundedRect; }]; [alertController addAction:[UIAlertAction actionWithTitle:@"Play" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSURL *url = [[NSURL alloc] initWithString:[[alertController textFields] firstObject].text]; VideoPlayerVC *videoController = [[VideoPlayerVC alloc] initWithNibName:@"VideoPlayerVC" bundle:nil url:url]; [self presentViewController:videoController animated:YES completion:nil]; }]]; [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; [self presentViewController:alertController animated:YES completion:nil]; } 

但是,我的应用程序正在崩溃,提供EXC_BAD_ACCESS。 在此处输入图像描述

在尝试了很多东西后,我终于改变了

 [self presentViewController:alertController animated:YES completion:nil]; 

 [self presentViewController:alertController animated:NO completion:nil]; 

在上面的代码中,它开始工作。

所以,我的问题是为什么将动画作为YES传递给那个崩溃?

此外,一个有趣的注意事项是,如果我重置我的整个模拟器并运行动画为YES的应用程序,那么它适用于前几次运行。 经过一些X运行后,它开始崩溃。