应用程序随机收到EXC_CRASH(SIGABRT)

时间:2012-10-24 23:23:30

标签: iphone ios crash crash-reports

我无法理解以下崩溃,因为它是随机发生的,我怀疑可能是一个多线程问题,但现在是:

Incident Identifier: 0BE956AB-228A-4B1B-8A3D-A99A481F7F3F
CrashReporter Key:   da7dc0be9da2f7fa677999d7093fdf2495031393
Hardware Model:      iPhone3,1
Process:         MyApp test [2899]
Path:            /var/mobile/Applications/D6419515-BA52-4747-94C5-5626F0E69571/MyApp test.app/MyApp test
Identifier:      MyApp test
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-10-24 19:42:40.289 +0200
OS Version:      iPhone OS 5.0.1 (9A405)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x33e118bf __exceptionPreprocess + 163
1   libobjc.A.dylib                 0x340611e5 objc_exception_throw + 33
2   CoreFoundation                  0x33e14acb -[NSObject doesNotRecognizeSelector:] + 175
3   CoreFoundation                  0x33e13945 ___forwarding___ + 301
4   CoreFoundation                  0x33d6e680 _CF_forwarding_prep_0 + 48
5   MyApp test                  0x000889f9 -[UploadPhotoViewController requestCompletedWithCode:] (UploadPhotoViewController.m:154)
6   CoreFoundation                  0x33d7022b -[NSObject performSelector:withObject:] + 43
7   MyApp test                  0x0005f6c9 -[ASIHTTPRequest reportFinished] (ASIHTTPRequest.m:2020)
8   CoreFoundation                  0x33d7022b -[NSObject performSelector:withObject:] + 43
9   Foundation                      0x357fb757 __NSThreadPerformPerform + 351
10  CoreFoundation                  0x33de5b03 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
11  CoreFoundation                  0x33de52cf __CFRunLoopDoSources0 + 215
12  CoreFoundation                  0x33de4075 __CFRunLoopRun + 653
13  CoreFoundation                  0x33d674dd CFRunLoopRunSpecific + 301
14  CoreFoundation                  0x33d673a5 CFRunLoopRunInMode + 105
15  GraphicsServices                0x305ebfcd GSEventRunModal + 157
16  UIKit                           0x371e8743 UIApplicationMain + 1091
17  MyApp test                  0x00032025 main (main.m:16)
18  MyApp test                  0x00031fd0 0x30000 + 8144

这是UploadPhotoViewController requestCompletedWithCode:method:

-(void)requestCompletedWithCode:(int)statusCode{

    [hud hide];

    if (statusCode == 201){
        UINavigationController *navVC = [self.tabBarController.viewControllers objectAtIndex:3];
//        UpdatesViewController *updatesVC= (UpdatesViewController *)[navVC visibleViewController];
        UpdatesViewController *updatesVC= (UpdatesViewController *)[navVC topViewController];
        updatesVC.newPhoto = YES;
        [self.tabBarController setSelectedIndex:3];
        [self.navigationController popViewControllerAnimated:NO];

    }
}

第154行指向:

    [self.tabBarController setSelectedIndex:3];

任何人都知道可能是什么问题?

修改

我通过这些线路从上一个VC到达UploadPhotoViewController(手边的VC):

  [self performSegueWithIdentifier:@"UploadPhoto" sender:self];
  [self dismissModalViewControllerAnimated: NO];

DismissModalViewControllerAnimated正在解雇UIImagePickerController。

非常感谢!

2 个答案:

答案 0 :(得分:0)

问题可能出在 [NSObject doesNotRecognizeSelector:] ,在某处您可能会覆盖或删除tabBarController(或从模态窗口实例化相同的视图控制器),它会变得疯狂。

答案 1 :(得分:0)

这可能有点矫枉过正,但为了测试(和学习)的目的,我会替换

[self.tabBarController setSelectedIndex:3];

if ([self.tabBarController respondsToSelector:@selector(setSelectedIndex:)])
    [self.tabBarController setSelectedIndex:3];
else
    NSLog(@"self.tabBarController is not an instance of UITabBarController");