iOS 8中UIAlertController崩溃

iOS 8中UIAlertController崩溃,ios,objective-c,iphone,uialertcontroller,Ios,Objective C,Iphone,Uialertcontroller,我收到了以下与UIAlertController相关的崩溃报告,无法再现崩溃 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Trying to dismiss UIAlertController <UIAlertController: 0x7a740910> with unknown presenter.' Application Specific

我收到了以下与UIAlertController相关的崩溃报告,无法再现崩溃

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Trying to dismiss UIAlertController <UIAlertController: 0x7a740910> with unknown presenter.'

Application Specific Backtrace 1:
0   CoreFoundation                      0x034dfdda ___exceptionPreprocess + 154
1   libobjc.A.dylib                     0x03169a97 _objc_exception_throw + 44
2   CoreFoundation                      0x034dfd1d +[NSException raise:format:] + 141
3   UIKit                               0x02268999 -[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 444
4   UIKit                               0x022687d8 -[UIAlertController _dismissAnimated:triggeringAction:] + 56
5   UIKit                               0x022683c4 -[UIAlertController _actionViewTapped:] + 68
6   libobjc.A.dylib                     0x0317f771 -[NSObject performSelector:withObject:] + 70
7   UIKit                               0x0244b06c -[_UIAlertControllerActionView _triggerSelect] + 60
8   UIKit                               0x0244af27 -[_UIAlertControllerActionView touchesEnded:withEvent:] + 187
9   UIKit                               0x023eb257 __UIGestureRecognizerUpdate + 13225
10  UIKit                               0x0200471b -[UIWindow _sendGesturesForEvent:] + 1356
11  UIKit                               0x0200557f -[UIWindow sendEvent:] + 769
12  UIKit                               0x01fcaaa9 -[UIApplication sendEvent:] + 242
13  UIKit                               0x01fda8de __UIApplicationHandleEventFromQueueEvent + 20690
14  UIKit                               0x01faf079 __UIApplicationHandleEventQueue + 2206
15  CoreFoundation                      0x034037bf ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16  CoreFoundation                      0x033f92cd ___CFRunLoopDoSources0 + 253
17  CoreFoundation                      0x033f8828 ___CFRunLoopRun + 952
18  CoreFoundation                      0x033f81ab _CFRunLoopRunSpecific + 443
19  CoreFoundation                      0x033f7fdb _CFRunLoopRunInMode + 123
20  GraphicsServices                    0x0564c24f _GSEventRunModal + 192
21  GraphicsServices                    0x0564c08c _GSEventRun + 104
22  UIKit                               0x01fb2e16 _UIApplicationMain + 1526
23  FantasyCricket                      0x001435ad _main + 141
24  libdyld.dylib                       0x04055ac9 _start + 1

同时在appDelegate中使用(通过获取当前控制器并在该控制器上显示警报)也会导致问题?

这可能会解决您的问题,因为ios 8中的UIAlertController存在错误。查看一下,可能会对您有所帮助。

您可以将代码粘贴到这里吗?我在应用程序中的许多地方使用了警报。但您可以使用断点查找代码中应用程序崩溃的那一行。因此,我们很容易帮到您。正如我所说,我无法复制它,而且我只经历了一次崩溃。从AppDelegate显示可能会导致问题?错误消息本身非常清楚。它说这是NSInternalInconsistencyException,因为提供UiAlertController的类现在不在那里,可能已解除分配。
if (NSClassFromString(@"UIAlertController"))
{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:title
                                                                   message:msg
                                                            preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK"
                                                            style:UIAlertActionStyleDefault
                                                          handler:nil];

    [alert addAction:defaultAction];

    //other UIAlertAction here......

    [self presentViewController:alert animated:YES completion:nil];
}
else
{
    [[[UIAlertView alloc]initWithTitle:title
                               message:msg
                              delegate:nil
                     cancelButtonTitle:@"OK"
                     otherButtonTitles:nil] show];
}