Objective c iOS 8';n内部一致性异常';,原因:';试图用未知的演示者关闭UIAlertController;

Objective c iOS 8';n内部一致性异常';,原因:';试图用未知的演示者关闭UIAlertController;,objective-c,xcode,ios8,Objective C,Xcode,Ios8,iOS8已弃用UIAlertview,需要使用UIAlertController 我试图使用Xcode 5.1进行编译,并在iOS 8 beta 4设备上运行它,因此无法直接实例化UIAlertController。我发现在代码库的大多数地方使用UIAlertView没有问题,除了两个类,即故事板的Appdelegate和initialViewController。我尝试创建一个自定义viewcontroller来处理UIAlertView,以查看它是否已修复,但仍在运行中。有线索吗?提前感谢。

iOS8已弃用
UIAlertview
,需要使用
UIAlertController


我试图使用Xcode 5.1进行编译,并在iOS 8 beta 4设备上运行它,因此无法直接实例化
UIAlertController
。我发现在代码库的大多数地方使用
UIAlertView
没有问题,除了两个类,即故事板的Appdelegate和initialViewController。我尝试创建一个自定义viewcontroller来处理
UIAlertView
,以查看它是否已修复,但仍在运行中。有线索吗?提前感谢。

在显示警报视图之前,请尝试使用以下代码添加延迟:

 dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC); 
            dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
                UIAlertView *crashAlert = [[UIAlertView alloc] initWithTitle:@"Alert"
                                                                     message:@"XYZ"
                                                                    delegate:self
                                                           cancelButtonTitle:@"No"
                                                           otherButtonTitles:@"Yes",@"Always", nil];
                [crashAlert show];

            });

这对我有用

请粘贴详细的代码并更好地解释您要做的事情。不太优雅,@Kavish。我称之为臭烘烘的快速修复:)