2017년 3월 8일 수요일

Xcode 8.2.1 application building시 크래쉬 발생

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
ProductBuildVersion: 8C1002
UNCAUGHT EXCEPTION (NSRangeException): *** -[__NSArrayM objectAtIndex:]: index 3 beyond bounds [0 .. 2]
UserInfo: (null)
Hints: 
  0: Creation Backtrace for Notification Token:

  0   -[_DVTNotificationReceiver initWithBlock:queue:] (in DVTFoundation)
  1   -[NSNotificationCenter(DVTNSNotificationCenterAdditions) dvt_addObserverForName:object:queue:usingBlock:] (in DVTFoundation)
  2   -[_IDENavigatorOutlineViewDataSource setRootItems:] (in IDEKit)
  3   -[IDENavigatorOutlineView _updateRootItems:sortDescriptors:] (in IDEKit)
  4   -[IDENavigatorOutlineView setRootItems:] (in IDEKit)
  5   -[IDENavigatorOutlineView _updateBoundContentArrayOrSet] (in IDEKit)
  6   -[IDENavigatorOutlineView updateBoundContentArray] (in IDEKit)
  7   -[NSObject(DVTBindingUtilities) updateBoundValueForBinding:] (in DVTKit)
  8   -[DVTBindingHelper observeValueForKeyPath:ofObject:change:context:] (in DVTKit)
  9   NSKeyValueNotifyObserver (in Foundation)
 10   NSKeyValueDidChange (in Foundation)
 11   -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] (in Foundation)
 12   _NSSetObjectValueAndNotify (in Foundation)
 13   -[IDEBatchFindNavigator updateScopeItems:] (in IDEKit)
 14   __44-[IDEBatchFindNavigator setupLocationPicker]_block_invoke_2 (in IDEKit)
 15   -[NSObject(DVTObservingConvenience) _dvt_newObserverForKeyPath:options:owner:creationBacktrace:withHandlerBlock:] (in DVTFoundation)
 16   -[NSObject(DVTObservingConvenience) dvt_newObserverForKeyPath:options:withHandlerBlock:] (in DVTFoundation)
 17   -[IDEBatchFindNavigator setupLocationPicker] (in IDEKit)
 18   -[IDEBatchFindNavigator viewDidInstall] (in IDEKit)
 19   -[DVTViewController _viewDidInstall] (in DVTKit)
 20   -[_DVTViewController_ViewLifecycleInterpositions viewDidMoveToWindow] (in DVTKit)
 21   -[NSView _setWindow:] (in AppKit)
 22   -[NSView addSubview:] (in AppKit)
 23   __42-[DVTReplacementView _setupViewController]_block_invoke (in DVTKit)
 24   DVTInvokeWithFailureHint (in DVTFoundation)
 25   -[DVTReplacementView _setupViewController] (in DVTKit)
 26   -[DVTReplacementView installedViewController] (in DVTKit)
 27   -[DVTReplacementView layoutTopDown] (in DVTKit)
 28   -[DVTLayoutView_ML _reallyLayoutIfNeededTopDown] (in DVTKit)
 29   +[DVTLayoutView_ML _doRecursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:completionCallBackHandlers:currentLayoutPass:needsSecondPass:] (in DVTKit)
 30   +[DVTLayoutView_ML _doRecursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:completionCallBackHandlers:currentLayoutPass:needsSecondPass:] (in DVTKit)
 31   +[DVTLayoutView_ML _doRecursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:completionCallBackHandlers:currentLayoutPass:needsSecondPass:] (in DVTKit)
 32   +[DVTLayoutView_ML _doRecursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:completionCallBackHandlers:currentLayoutPass:needsSecondPass:] (in DVTKit)
 33   +[DVTLayoutView_ML _doRecursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:completionCallBackHandlers:currentLayoutPass:needsSecondPass:] (in DVTKit)
 34   +[DVTLayoutView_ML _doRecursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:completionCallBackHandlers:currentLayoutPass:needsSecondPass:] (in DVTKit)
 35   +[DVTLayoutView_ML _recursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:] (in DVTKit)
 36   -[DVTLayoutView_ML viewWillDraw] (in DVTKit)
 37   -[NSView viewWillDraw] (in AppKit)
 38   -[NSView viewWillDraw] (in AppKit)
 39   -[NSView viewWillDraw] (in AppKit)
 40   -[NSView _sendViewWillDrawInRect:clipRootView:] (in AppKit)
 41   -[NSView displayIfNeeded] (in AppKit)
 42   -[NSWindow displayIfNeeded] (in AppKit)
 43   ___NSWindowGetDisplayCycleObserver_block_invoke6365 (in AppKit)
 44   __37+[NSDisplayCycle currentDisplayCycle]_block_invoke (in AppKit)
 45   CA::Transaction::run_commit_handlers(CATransactionPhase) (in QuartzCore)
 46   CA::Context::commit_transaction(CA::Transaction*) (in QuartzCore)
 47   CA::Transaction::commit() (in QuartzCore)
 48   CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) (in QuartzCore)
 49   __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ (in CoreFoundation)
 50   __CFRunLoopDoObservers (in CoreFoundation)
 51   CFRunLoopRunSpecific (in CoreFoundation)
 52   RunCurrentEventLoopInMode (in HIToolbox)
 53   ReceiveNextEventCommon (in HIToolbox)
 54   _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
 55   _DPSNextEvent (in AppKit)
 56   -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
 57   -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
 58   -[NSApplication run] (in AppKit)
 59   NSApplicationMain (in AppKit)
 60   start (in libdyld.dylib)

Backtrace:
  0   __exceptionPreprocess (in CoreFoundation)
  1   DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2   objc_exception_throw (in libobjc.A.dylib)
  3   -[__NSArrayM objectAtIndex:] (in CoreFoundation)
  4   -[_IDENavigatorOutlineViewDataSource outlineView:child:ofItem:] (in IDEKit)
  5   refreshRowEntryItemAndLevelInfo (in AppKit)
  6   -[NSOutlineView reloadItem:reloadChildren:] (in AppKit)
  7   -[IDENavigatorOutlineView reloadItem:reloadChildren:] (in IDEKit)
  8   __83-[_IDENavigatorOutlineViewDataSource _processNavigableItemGraphChangeNotification:]_block_invoke.735 (in IDEKit)
  9   +[NSAnimationContext(DVTNSAnimationContextAdditions) dvt_nonAnimatedBlock:] (in DVTKit)
 10   -[IDENavigatorOutlineView suspendEditingWhilePerformingBlock:] (in IDEKit)
 11   -[_IDENavigatorOutlineViewDataSource _processNavigableItemGraphChangeNotification:] (in IDEKit)
 12   DVTInvokeWithLazyFailureHint (in DVTFoundation)
 13   __48-[_DVTNotificationReceiver receiveNotification:]_block_invoke.42 (in DVTFoundation)
 14   -[_DVTNotificationReceiver receiveNotification:] (in DVTFoundation)
 15   __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (in CoreFoundation)
 16   ___CFXRegistrationPost_block_invoke (in CoreFoundation)
 17   _CFXRegistrationPost (in CoreFoundation)
 18   ___CFXNotificationPost_block_invoke (in CoreFoundation)
 19   -[_CFXNotificationRegistrar find:object:observer:enumerator:] (in CoreFoundation)
 20   _CFXNotificationPost (in CoreFoundation)
 21   -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation)
 22   -[NSNotificationCenter(DVTNSNotificationCenterAdditions) _dvt_postNotificationName:object:userInfo:] (in DVTFoundation)
 23   -[IDENavigableItemCoordinator _postNotificationNamed:forChangedItems:] (in IDEKit)
 24   -[IDENavigableItemCoordinator _delayedPostGraphAndPropertyChangeNotifications] (in IDEKit)
 25   __48-[DVTDelayedInvocation initWithTarget:selector:]_block_invoke (in DVTFoundation)
 26   -[DVTDelayedInvocation runBlock:] (in DVTFoundation)
 27   __NSFirePerformWithOrder (in Foundation)
 28   __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ (in CoreFoundation)
 29   __CFRunLoopDoObservers (in CoreFoundation)
 30   __CFRunLoopRun (in CoreFoundation)
 31   CFRunLoopRunSpecific (in CoreFoundation)
 32   RunCurrentEventLoopInMode (in HIToolbox)
 33   ReceiveNextEventCommon (in HIToolbox)
 34   _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
 35   _DPSNextEvent (in AppKit)
 36   -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
 37   -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
 38   -[NSApplication run] (in AppKit)
 39   NSApplicationMain (in AppKit)
 40   start (in libdyld.dylib)

abort() called

Application Specific Signatures:
NSRangeException

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff9993a452 __exceptionPreprocess + 178
1   DVTFoundation                       0x0000000106127762 DVTFailureHintExceptionPreprocessor + 194
2   libobjc.A.dylib                     0x00007fff882b8f7e objc_exception_throw + 48
3   CoreFoundation                      0x00007fff99851725 -[__NSArrayM objectAtIndex:] + 245
4   IDEKit                              0x000000010776c830 -[_IDENavigatorOutlineViewDataSource outlineView:child:ofItem:] + 190
5   AppKit                              0x00007fff86d092e5 refreshRowEntryItemAndLevelInfo + 327
6   AppKit                              0x00007fff86d02f67 -[NSOutlineView reloadItem:reloadChildren:] + 3024
7   IDEKit                              0x0000000107767d7b -[IDENavigatorOutlineView reloadItem:reloadChildren:] + 357
8   IDEKit                              0x000000010776ac2e __83-[_IDENavigatorOutlineViewDataSource _processNavigableItemGraphChangeNotification:]_block_invoke.735 + 522
9   DVTKit                              0x000000010685464f +[NSAnimationContext(DVTNSAnimationContextAdditions) dvt_nonAnimatedBlock:] + 132
10  IDEKit                              0x0000000107765441 -[IDENavigatorOutlineView suspendEditingWhilePerformingBlock:] + 101
11  IDEKit                              0x000000010776a76d -[_IDENavigatorOutlineViewDataSource _processNavigableItemGraphChangeNotification:] + 2226
12  DVTFoundation                       0x0000000106127576 DVTInvokeWithLazyFailureHint + 100
13  DVTFoundation                       0x00000001060e1f32 __48-[_DVTNotificationReceiver receiveNotification:]_block_invoke.42 + 149
14  DVTFoundation                       0x00000001060e1c7f -[_DVTNotificationReceiver receiveNotification:] + 1054
15  CoreFoundation                      0x00007fff998c5b1c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
16  CoreFoundation                      0x00007fff998c5aaf ___CFXRegistrationPost_block_invoke + 63
17  CoreFoundation                      0x00007fff998c5a27 _CFXRegistrationPost + 407
18  CoreFoundation                      0x00007fff998c5792 ___CFXNotificationPost_block_invoke + 50
19  CoreFoundation                      0x00007fff99882542 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
20  CoreFoundation                      0x00007fff99881795 _CFXNotificationPost + 693
21  Foundation                          0x00007fff9718e17a -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
22  DVTFoundation                       0x00000001060e338a -[NSNotificationCenter(DVTNSNotificationCenterAdditions) _dvt_postNotificationName:object:userInfo:] + 360
23  IDEKit                              0x000000010794c00f -[IDENavigableItemCoordinator _postNotificationNamed:forChangedItems:] + 542
24  IDEKit                              0x000000010794c35d -[IDENavigableItemCoordinator _delayedPostGraphAndPropertyChangeNotifications] + 713
25  DVTFoundation                       0x0000000105ef15a8 __48-[DVTDelayedInvocation initWithTarget:selector:]_block_invoke + 79
26  DVTFoundation                       0x0000000105ef298b -[DVTDelayedInvocation runBlock:] + 257
27  Foundation                          0x00007fff9726884a __NSFirePerformWithOrder + 339
28  CoreFoundation                      0x00007fff998cefc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
29  CoreFoundation                      0x00007fff998cef37 __CFRunLoopDoObservers + 391
30  CoreFoundation                      0x00007fff998ae408 __CFRunLoopRun + 872
31  CoreFoundation                      0x00007fff998ade38 CFRunLoopRunSpecific + 296
32  HIToolbox                           0x00007fff87c2b935 RunCurrentEventLoopInMode + 235
33  HIToolbox                           0x00007fff87c2b76f ReceiveNextEventCommon + 432
34  HIToolbox                           0x00007fff87c2b5af _BlockUntilNextEventMatchingListInModeWithFilter + 71
35  AppKit                              0x00007fff869a2df6 _DPSNextEvent + 1067
36  AppKit                              0x00007fff869a2226 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
37  DVTKit                              0x00000001066d1eaf -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 396
38  AppKit                              0x00007fff86996d80 -[NSApplication run] + 682
39  AppKit                              0x00007fff86960368 NSApplicationMain + 1176
40  libdyld.dylib                       0x00007fff94a015ad start + 1
41  ???                                 0x0000000000000001 0x0 + 1

위와 같은 콜스택을 뿜으며 빌 Xcode 서 앱을 빌드 하다가 크래쉬가 발생하면서 비정상 종료 하고 다시  Xcode를 실행 시키면 실행 바로 크래쉬 되어  Xcode 수행이 어려운 경우

이런 경우
rm -rf ~/Library/Developer/Xcode/DerivedData



위 명령을 수행하여 Xcode를 수행 가능 하게는 할 수 있으나
다시 빌드를 하면 또 비정상 종료 되는 경우가 있다.

이런 경우 해결 방법

1.  Product -> Scheme -> Manage Scheme 
에서 새로운 빌드 스킴을 만들고 이전 빌드 스킴 대신 사용해본다.

위와 같이 해도 크래쉬가 발생하면

Pod 로 서드 파티 라이브러리를 이용하고  .xcworkspace를 사용중이라면
다음의 절차를 수행 한다.

프로젝트. xcworkspace파일을 과감하게 삭제 하고
pod install 명령으로 새로 .xcworkspace를 생성 하여 xcode를 새로 생성된 xcworkspace
파일로 시작 하고 빌드 한다.