2014-10-07 120 views
0

我得到了與UIAlertController相關的崩潰報告,無法重現崩潰。iOS中的UIAlertController崩潰8

*** 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 

我正在使用AlertController for iOS 8及更高版本。

編輯:用於顯示警報

示例代碼:

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]; 
} 

中的appDelegate也使用(通過獲取電流控制器和控制器上呈現警報)也可以是原因要點..?

+0

你能在這裏粘貼你的代碼嗎? – Ricky 2014-10-07 06:02:41

+0

我在應用程序中的許多地方使用警報。 – Pushparaj 2014-10-07 06:04:07

+0

,但您可以使用斷點來查找代碼中應用程序崩潰的行。因此,我們很容易就可以幫助您。 – Ricky 2014-10-07 06:10:01

回答

0

這可能會解決您的問題,因爲在使用UIAlertController的ios 8中存在一個錯誤。看看this link,可能對你有幫助。