0

我很难理解以下崩溃,因为它是随机发生的,我怀疑可能是多线程问题,但它是:

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: 方法:

-(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。

非常感谢!

4

2 回答 2

0

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

于 2012-10-24T23:30:50.593 回答
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");
于 2012-10-24T23:41:41.240 回答