viewDidLoad ios7上的奇怪异常NSInvalidArgument

时间:2014-03-24 07:36:17

标签: iphone ios7 nsexception

好的,所以我正在使用Xcode 5在ios7下为iPhone编写应用程序 我有主视图控制器,它是桌面视图控制器,并且启动它一切正常,视图加载通常没有任何错误,但然后我离开这个视图控制器,使用一些其他场景,并通过segue回到它我得到了这样:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

这是方法的代码

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSLog(@"from CollectInfoTVC, viewDidLoad");
    // Set the side bar button action. When it's tapped, it'll show up the sidebar.
    _sidebarButton.target = self.revealViewController;
    _sidebarButton.action = @selector(revealToggle:);

    // Set the gesture
    [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];

    _cancelCarButton.hidden = YES;
}

你们可以帮助我吗?

更新。#1:调用堆栈看起来像这样

2014-03-24 11:48:23.286 demotaxi[28008:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001033ed495 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x00000001030a799e objc_exception_throw + 43
    2   CoreFoundation                      0x00000001033a4374 -[__NSArrayM insertObject:atIndex:] + 820
    3   UIKit                               0x0000000101cb40da -[UIView(UIViewGestures) addGestureRecognizer:] + 199
    4   demotaxi                            0x000000010001eaf7 -[CollectInfoTableViewController viewDidLoad] + 359
    5   UIKit                               0x0000000101d4a59e -[UIViewController loadViewIfRequired] + 562
    6   UIKit                               0x0000000101d4a777 -[UIViewController view] + 29
    7   UIKit                               0x0000000101d5811a -[UIViewController shouldAutorotate] + 30
    8   UIKit                               0x0000000101d58402 -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] + 236
    9   UIKit                               0x0000000101fa6519 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:] + 1798
    10  UIKit                               0x0000000101d54fce -[UIViewController presentViewController:withTransition:completion:] + 4854
    11  demotaxi                            0x0000000100006ddc -[Wait4CarViewController rewind2Main] + 60
    12  Foundation                          0x0000000102c91e14 __NSFireTimer + 83
    13  CoreFoundation                      0x00000001033afc34 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    14  CoreFoundation                      0x00000001033af7b2 __CFRunLoopDoTimer + 962
    15  CoreFoundation                      0x00000001033987be __CFRunLoopRun + 1614
    16  CoreFoundation                      0x0000000103397d83 CFRunLoopRunSpecific + 467
    17  GraphicsServices                    0x0000000103dacf04 GSEventRunModal + 161
    18  UIKit                               0x0000000101c54e33 UIApplicationMain + 1010
    19  demotaxi                            0x00000001000265e3 main + 115
    20  libdyld.dylib                       0x00000001044455fd start + 1
    21  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

0 个答案:

没有答案