How do I find the name of an NSNotification from a crash report?

How do I find the name of an NSNotification from a crash report?

The crash report starts with __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ and no user code is executing so I am assuming that a notification was sent to a released object. The crash occurs when an NSInternalInconsistencyException is thrown due to "UITableView dataSource is not set". Is the name of the notification saved in a register so I can use the offset to find the string?

Replies

Can you post an example crash log for this? I want to confirm some details before I offer an opinion here.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Application Specific Information:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource is not set'

Last Exception Backtrace:

0 CoreFoundation 0x000000018a2991b8 __exceptionPreprocess + 124

1 libobjc.A.dylib 0x0000000188cd055c objc_exception_throw + 55

2 CoreFoundation 0x000000018a29908c +[NSException raise:format:arguments:] + 103

3 Foundation 0x000000018ad5102c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 111

4 UIKit 0x000000019048aaf8 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 619

5 UIKit 0x000000019048ad88 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 79

6 UIKit 0x0000000190478320 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2303

7 UIKit 0x000000019021e694 -[UITableView _setNeedsVisibleCellsUpdate:withFrames:] + 195

8 UIKit 0x000000019021e588 -[UITableView _rectChangedWithNewSize:oldSize:] + 995

9 UIKit 0x000000019021d8f0 -[UITableView setFrame:] + 255

10 UIKit 0x000000019015e6d0 -[UIView+ 157392 (Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 599

11 UIKit 0x0000000190b0e6e0 -[UIScrollView+ 10315488 (_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:] + 51

12 CoreFoundation 0x000000018a185414 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 131

13 CoreFoundation 0x000000018a185310 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 311

14 UIKit 0x000000019014d178 -[UIView+ 86392 (Geometry) resizeSubviewsWithOldSize:] + 151

15 UIKit 0x000000019014122c -[UIView+ 37420 (Geometry) setFrame:] + 967

16 UIKit 0x000000019015e6d0 -[UIView+ 157392 (Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 599

17 CoreFoundation 0x000000018a185414 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 131

18 CoreFoundation 0x000000018a185310 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 311

19 UIKit 0x000000019014d178 -[UIView+ 86392 (Geometry) resizeSubviewsWithOldSize:] + 151

20 UIKit 0x000000019014122c -[UIView+ 37420 (Geometry) setFrame:] + 967

21 UIKit 0x000000019015e6d0 -[UIView+ 157392 (Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 599

22 CoreFoundation 0x000000018a185414 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 131

23 CoreFoundation 0x000000018a185310 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 311

24 UIKit 0x000000019014d178 -[UIView+ 86392 (Geometry) resizeSubviewsWithOldSize:] + 151

25 UIKit 0x000000019014122c -[UIView+ 37420 (Geometry) setFrame:] + 967

26 UIKit 0x000000019015e6d0 -[UIView+ 157392 (Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 599

27 CoreFoundation 0x000000018a185414 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 131

28 CoreFoundation 0x000000018a185310 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 311

29 UIKit 0x000000019014d178 -[UIView+ 86392 (Geometry) resizeSubviewsWithOldSize:] + 151

30 UIKit 0x000000019014122c -[UIView+ 37420 (Geometry) setFrame:] + 967

31 UIKit 0x000000019015e6d0 -[UIView+ 157392 (Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 599

32 CoreFoundation 0x000000018a185414 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 131

33 CoreFoundation 0x000000018a185310 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 311

34 UIKit 0x000000019014d178 -[UIView+ 86392 (Geometry) resizeSubviewsWithOldSize:] + 151

35 UIKit 0x000000019014122c -[UIView+ 37420 (Geometry) setFrame:] + 967

36 UIKit 0x0000000190421e28 -[UIWindow setFrame:] + 391

37 UIKit 0x00000001903d29b4 -[UIApplication setStatusBarOrientation:animationParameters:notifySpringBoardAndFence:updateBlock:] + 679

38 UIKit 0x000000019041ec58 __78-[UIWindow _rotateWindowToOrientation:updateStatusBar:duration:skipCallbacks:]_block_invoke.1163 + 291

39 UIKit 0x0000000190809828 __58-[_UIWindowRotationAnimationController animateTransition:]_block_invoke_2 + 167

40 UIKit 0x0000000190447938 +[UIView+ 3209528 (Internal) _performBlockDelayingTriggeringResponderEvents:] + 219

41 UIKit 0x000000019080962c __58-[_UIWindowRotationAnimationController animateTransition:]_block_invoke + 135

42 UIKit 0x0000000190809510 -[_UIWindowRotationAnimationController animateTransition:] + 515

43 UIKit 0x000000019041d034 -[UIWindow _rotateToBounds:withAnimator:transitionContext:] + 615

44 UIKit 0x000000019041e808 -[UIWindow _rotateWindowToOrientation:updateStatusBar:duration:skipCallbacks:] + 1259

45 UIKit 0x00000001901c6cbc -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 543

46 UIKit 0x00000001901c6948 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 151

47 UIKit 0x00000001901bd478 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 123

48 UIKit 0x0000000190148b28 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 475

49 UIKit 0x000000019060d3a0 -[UIScreen _notifySceneBoundsChanged:] + 463

50 UIKit 0x000000019060b0e4 -[UIScreen _updateReferenceBoundsToSceneReferenceBounds:fromInterfaceOrientation:animated:] + 415

51 UIKit 0x00000001903d8d68 __83-[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:]_block_invoke_2 + 35

52 UIKit 0x00000001904b0638 +[UIViewController _performWithoutDeferringTransitions:] + 127

53 UIKit 0x00000001903d8d10 __83-[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:]_block_invoke + 139

54 UIKit 0x00000001901557dc +[UIView+ 120796 (Animation) performWithoutAnimation:] + 103

55 UIKit 0x00000001903d89d8 -[UIApplication _createSnapshotContextForScene:withName:performLayoutWithSettings:] + 411

56 UIKit 0x00000001903d9fa0 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke_2 + 123

57 FrontBoardServices 0x000000018be6d85c -[FBSSceneSnapshotAction _executeNextRequest] + 239

58 FrontBoardServices 0x000000018be6d480 -[FBSSceneSnapshotAction executeRequestsWithHandler:completionHandler:expirationHandler:] + 227

59 UIKit 0x00000001903d9ec0 __65-[UIApplication _performSnapshotsWithAction:forScene:completion:]_block_invoke + 287

60 UIKit 0x00000001903d9528 -[UIApplication _beginSnapshotSessionForScene:withSnapshotBlock:] + 951

61 UIKit 0x00000001903d9d4c -[UIApplication _performSnapshotsWithAction:forScene:completion:] + 551

62 UIKit 0x00000001903d9aa8 -[UIApplication _handleSnapshotAction:forScene:completion:] + 155

63 UIKit 0x00000001903d8fdc _runAfterCACommitDeferredBlocks + 291

64 UIKit 0x00000001903cad50 _cleanUpAfterCAFlushAndRunDeferredBlocks + 559

65 UIKit 0x000000019013a0b4 _afterCACommitHandler + 167

66 CoreFoundation 0x000000018a2460c0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 31

67 CoreFoundation 0x000000018a243cf0 __CFRunLoopDoObservers + 371

68 CoreFoundation 0x000000018a244180 __CFRunLoopRun + 1023

69 CoreFoundation 0x000000018a1722b8 CFRunLoopRunSpecific + 443

70 GraphicsServices 0x000000018bc26198 GSEventRunModal + 179

71 UIKit 0x00000001901b27fc -[UIApplication _run] + 683

72 UIKit 0x00000001901ad534 UIApplicationMain + 207

73 POS_Enterprise 0x00000001000922e0 main + 74464 (main.m:15)

74 libdyld.dylib 0x00000001891555b8 start + 3

Ah, I thought so. You seem to be confusing two uses of the term observer:

  • In the context of an

    NSNotification
    , an observer is an object on which a method is called when a notification is posted
  • In the context of a run loop, an observer is a function that’s called at certain stages in the run loop cycle

Frame 66 of your backtrace is using the second meaning, and thus this has nothing to do with

NSNotification
. Rather, Core Animation has a function (frame 65,
_afterCACommitHandler
) that’s called as part of the run loop cycle and that does a whole bunch of work that eventually invokes UIKit.

To investigate this further you should look at the stack frames closer to the failure point. Specifically, frame 4 and 3 indicates that UIKit has thrown a language exception because of something has gone wrong with table view cell preparation. As to what went wrong, you can see that in the Application Specific Information section, where it says:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource is not set'

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"