Ios UIAlertController无法在iPhone 8设备上正确关闭

Ios UIAlertController无法在iPhone 8设备上正确关闭,ios,iphone,uialertcontroller,ios12,Ios,Iphone,Uialertcontroller,Ios12,问题在于iOS 12的iPhone 8或iPhone 6上的UIAlertVIewController无法正常工作。 当不在视图控制器中时,我需要显示警报,使用下面的参考,我能够显示警报 但当我点击“OK”警报,但灰色背景不会消失时,我们只能关闭该应用程序。附上屏幕截图。 同样的代码在iPhoneX中运行良好,不确定下面的代码中会出现什么错误 UIAlertController *alertvc = [UIAlertController alertControllerWithTitle:@"

问题在于iOS 12的iPhone 8或iPhone 6上的UIAlertVIewController无法正常工作。 当不在视图控制器中时,我需要显示警报,使用下面的参考,我能够显示警报

但当我点击“OK”警报,但灰色背景不会消失时,我们只能关闭该应用程序。附上屏幕截图。

同样的代码在iPhoneX中运行良好,不确定下面的代码中会出现什么错误

UIAlertController *alertvc = [UIAlertController alertControllerWithTitle:@"Device Registeration Error" message:"Device Error" preferredStyle:UIAlertControllerStyleAlert];
[alertvc addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {}]];   
[[[UIApplication sharedApplication] delegate].window.rootViewController presentViewController:alertvc animated:YES completion:nil];

点击“确定”后,警报的灰色背景仍然存在,它不会消失,不知道代码哪里出错。

尝试将
UIAlertAction
处理程序
更改为
nil
@Yonat-添加nil也不起作用