仅在运行XCTest时viewDidLoad崩溃

时间:2015-03-02 13:47:13

标签: ios xctest

我有一个基于UISplitViewController的iOS应用程序,它已经运行了好几个月。现在我正在尝试添加一些单元测试但是当我运行测试时,每次主视图完成viewDidLoad时它都会崩溃。主视图是导航控制器内的标准列表视图。有人知道为什么吗?堆栈跟踪在下面。

2015-03-02 08:28:11.775 [INFO ] myapp[10503:607] TeamsViewController:37 - viewDidLoad
2015-03-02 08:28:11.790 myapp[10503:812618] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x03f0f946 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x03b98a97 objc_exception_throw + 44
    2   CoreFoundation                      0x03dc6c01 -[__NSArrayM insertObject:atIndex:] + 881
    3   CoreFoundation                      0x03dc6861 -[__NSArrayM addObject:] + 65
    4   UIKit                               0x02cf535c PushNextClassForSettingIMP + 383
    5   UIKit                               0x02cf5149 __workaround10030904InvokeWithTarget_block_invoke + 29
    6   UIKit                               0x02747f05 +[UIView _performCustomizableAppearanceModifications:] + 29
    7   UIKit                               0x02cf5121 workaround10030904InvokeWithTarget + 1047
    8   UIKit                               0x02ceee05 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 4248
    9   UIKit                               0x02cef624 +[_UIAppearance _applyInvocationsTo:window:] + 56
    10  UIKit                               0x027636f5 -[UIView(Internal) _applyAppearanceInvocations] + 287
    11  UIKit                               0x02764139 __88-[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]_block_invoke + 65
    12  UIKit                               0x027640c6 -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 204
    13  UIKit                               0x02763ff3 -[UIView(Internal) _didChangeFromIdiom:onScreen:traverseHierarchy:] + 57
    14  UIKit                               0x02763fb2 -[UIView(Internal) _didChangeFromIdiomOnScreen:traverseHierarchy:] + 172
    15  UIKit                               0x027635a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1685
    16  UIKit                               0x0276323f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
    17  UIKit                               0x0276323f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
    18  UIKit                               0x0276323f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
    19  UIKit                               0x027763e1 -[UIScrollView _didMoveFromWindow:toWindow:] + 65
    20  UIKit                               0x0276323f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
    21  UIKit                               0x0275a517 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 154
    22  UIKit                               0x0275a475 -[UIView(Hierarchy) _postMovedFromSuperview:] + 458
    23  UIKit                               0x02765f0d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 2018
    24  UIKit                               0x0275886e -[UIView(Hierarchy) addSubview:] + 56
    25  UIKit                               0x02ab6d96 -[UINavigationTransitionView transition:fromView:toView:] + 501
    26  UIKit                               0x02ab6b98 -[UINavigationTransitionView transition:toView:] + 56
    27  UIKit                               0x0286c33a -[UINavigationController _startTransition:fromViewController:toViewController:] + 3124
    28  UIKit                               0x0286c6fb -[UINavigationController _startDeferredTransitionIfNeeded:] + 669
    29  UIKit                               0x0286d372 -[UINavigationController __viewWillLayoutSubviews] + 57
    30  UIKit                               0x029e104c -[UILayoutContainerView layoutSubviews] + 213
    31  UIKit                               0x1241c60f -[UILayoutContainerViewAccessibility layoutSubviews] + 50
    32  UIKit                               0x02768dd1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
    33  libobjc.A.dylib                     0x03bae771 -[NSObject performSelector:withObject:] + 70
    34  QuartzCore                          0x0244128f -[CALayer layoutSublayers] + 152
    35  QuartzCore                          0x02435115 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 397
    36  QuartzCore                          0x02434f70 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    37  QuartzCore                          0x023933c6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
    38  QuartzCore                          0x0239478c _ZN2CA11Transaction6commitEv + 392
    39  QuartzCore                          0x02394e58 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    40  CoreFoundation                      0x03e329de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    41  CoreFoundation                      0x03e32920 __CFRunLoopDoObservers + 400
    42  CoreFoundation                      0x03e27be9 CFRunLoopRunSpecific + 473
    43  CoreFoundation                      0x03e279fb CFRunLoopRunInMode + 123
    44  Foundation                          0x01de4d98 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 309
    45  XCTest                              0x20104939 -[XCTestDriver _checkForTestManager] + 248
    46  XCTest                              0x20104c6b -[XCTestDriver runTestSuite:completionHandler:] + 378
    47  XCTest                              0x2011775c +[XCTestProbe runTests:] + 216
    48  Foundation                          0x01de0b57 __NSFireDelayedPerform + 423
    49  CoreFoundation                      0x03e698d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    50  CoreFoundation                      0x03e6925d __CFRunLoopDoTimer + 1309
    51  CoreFoundation                      0x03e286ba __CFRunLoopRun + 2090
    52  CoreFoundation                      0x03e27bcb CFRunLoopRunSpecific + 443
    53  CoreFoundation                      0x03e279fb CFRunLoopRunInMode + 123
    54  GraphicsServices                    0x05fe524f GSEventRunModal + 192
    55  GraphicsServices                    0x05fe508c GSEventRun + 104
    56  UIKit                               0x026dd8b6 UIApplicationMain + 1526
    57  myapp                          0x001dd3ee top_level_code + 78
    58  myapp                          0x001dd57b main + 43
    59  libdyld.dylib                       0x047faac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

0 个答案:

没有答案
相关问题