I have a NSSplitView inside a NSViewController's xib file. If I connect the delegate outlet to File's Owner, or if I do the same thing in code (self.splitView.delegate = self) then the app crashes. No error message, it just stops in main.m. I have not implemented any of the NSSplitViewDelegate methods, just connected the outlet. Here's the backtrace:
* thread #1: tid = 0x6f27f8, 0x00007fff8f58a097 libobjc.A.dylib`objc_msgSend + 23, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x00007fff8f58a097 libobjc.A.dylib`objc_msgSend + 23
frame #1: 0x00007fff8dfb98d8 AppKit`-[NSSplitView _effectiveFrameForDrawnFrame:ofDividerAtIndex:] + 477
frame #2: 0x00007fff8dfb9499 AppKit`-[NSSplitView resetCursorRects] + 500
frame #3: 0x00007fff8df62664 AppKit`-[NSView(NSInternal) _updateTrackingAreas] + 610
frame #4: 0x00007fff8df62a17 AppKit`-[NSView(NSInternal) _updateTrackingAreas] + 1557
frame #5: 0x00007fff8df62a17 AppKit`-[NSView(NSInternal) _updateTrackingAreas] + 1557
frame #6: 0x00007fff8df62a17 AppKit`-[NSView(NSInternal) _updateTrackingAreas] + 1557
frame #7: 0x00007fff8df62a17 AppKit`-[NSView(NSInternal) _updateTrackingAreas] + 1557
frame #8: 0x00007fff8dfb8f34 AppKit`_handleInvalidCursorRectsNote + 994
frame #9: 0x00007fff8e5968a1 AppKit`__35-[NSWindow _postInvalidCursorRects]_block_invoke2988 + 46
frame #10: 0x00007fff81f7de17 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #11: 0x00007fff81f7dd87 CoreFoundation`__CFRunLoopDoObservers + 391
frame #12: 0x00007fff81f6f468 CoreFoundation`__CFRunLoopRun + 776
frame #13: 0x00007fff81f6ef25 CoreFoundation`CFRunLoopRunSpecific + 309
frame #14: 0x00007fff87070a0d HIToolbox`RunCurrentEventLoopInMode + 226
frame #15: 0x00007fff87070685 HIToolbox`ReceiveNextEventCommon + 173
frame #16: 0x00007fff870705bc HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 65
frame #17: 0x00007fff8de1c3de AppKit`_DPSNextEvent + 1434
frame #18: 0x00007fff8de1ba2b AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
frame #19: 0x00007fff8de0fb2c AppKit`-[NSApplication run] + 553
frame #20: 0x00007fff8ddfa913 AppKit`NSApplicationMain + 940
I have another split view in the app, although it's in a NSWindowController, not view controller. It works fine with the delegate connection. The problematic split view controller is inside one of the window controller's split view panes, if that matters. I should be able to nest them, right?
Related
After updating the App to XCode 12 and iOS 14. I get a frequent crash where it does not show the Application line. Below I've given the backtrace I printed from XCode. Rarely I see the crash line stops at executeFetchRequest. I am not sure if this is related to this. How do I debug this issue and stop the crash happening.
Using Xcode 12.1
Device iPhone XS and iPad Air 2.
(lldb) bt
* thread #12, queue = 'NSManagedObjectContext 0x28185a2f0', stop reason = EXC_BAD_ACCESS (code=1, address=0x2dafa5100)
* frame #0: 0x00000001ba152534 libobjc.A.dylib`object_getIndexedIvars + 28
frame #1: 0x00000001ac0f67a8 CoreData`_PFObjectIDFastHash64 + 36
frame #2: 0x00000001a608e4f8 CoreFoundation`__CFBasicHashRehash + 992
frame #3: 0x00000001a6092414 CoreFoundation`CFBasicHashRemoveValue + 2384
frame #4: 0x00000001a5fa9ec0 CoreFoundation`CFDictionaryRemoveValue + 236
frame #5: 0x00000001ac0431c0 CoreData`-[NSManagedObjectContext(_NSInternalAdditions) _forgetObject:propagateToObjectStore:removeFromRegistry:] + 124
frame #6: 0x00000001ac0226ec CoreData`-[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 860
frame #7: 0x00000001ac140198 CoreData`__90-[NSManagedObjectContext(_NSInternalNotificationHandling) _registerAsyncReferenceCallback]_block_invoke + 72
frame #8: 0x00000001ac136410 CoreData`developerSubmittedBlockToNSManagedObjectContextPerform + 164
frame #9: 0x00000001016a15f0 libdispatch.dylib`_dispatch_client_callout + 20
frame #10: 0x00000001016a8fa8 libdispatch.dylib`_dispatch_lane_serial_drain + 736
frame #11: 0x00000001016a9cb4 libdispatch.dylib`_dispatch_lane_invoke + 448
frame #12: 0x00000001016b5e38 libdispatch.dylib`_dispatch_workloop_worker_thread + 1520
frame #13: 0x00000001edf53908 libsystem_pthread.dylib`_pthread_wqthread + 276
I am getting:
'KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED',
notification when I close the main window of document based Cocoa ObjC application. I do not have any KVO observers in my project in this area so there is no observer to remove. Using NSZombie doesn't work to diagnose. I suspected that a re-used memory address might be the issue. Can anyone recommend how I can determine the objects involved in this problem? Ideally I would like to see the observer object so I can work backwards from there.
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3eadde6d1760)
frame #0: 0x00007fff68cf38ee libobjc.A.dylib`object_isClass + 31
* frame #1: 0x00007fff3f0840f6 Foundation`KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED + 58
frame #2: 0x00007fff3f2145fe Foundation`NSKeyValueWillChangeWithPerThreadPendingNotifications.llvm.15835543126851482145 + 282
frame #3: 0x00007fff47cfd935 QuartzCore`CAAnimation_setter(CAAnimation*, unsigned int, _CAValueType, void const*) + 132
frame #4: 0x00007fff47cfdeca QuartzCore`-[CAAnimation setDuration:] + 45
frame #5: 0x00007fff47d0314e QuartzCore`-[CALayer addAnimation:forKey:] + 332
frame #6: 0x00007fff47cb26dc QuartzCore`CA::Layer::remove_sublayer(CA::Transaction*, CALayer*) + 334
frame #7: 0x00007fff47cb2554 QuartzCore`CA::Layer::remove_from_superlayer() + 126
frame #8: 0x00007fff3a2f49a4 AppKit`-[NSView _removeLayerFromSuperlayer] + 229
frame #9: 0x00007fff3a2f431f AppKit`-[NSView _setSuperview:] + 225
frame #10: 0x00007fff3a2f7b01 AppKit`-[NSView removeFromSuperview] + 149
frame #11: 0x00007fff3a3dfa88 AppKit`-[NSView removeFromSuperviewWithoutNeedingDisplay] + 36
frame #12: 0x00007fff3a37dbf5 AppKit`-[NSView _finalize] + 1060
frame #13: 0x00007fff3a37d64a AppKit`-[NSView dealloc] + 209
frame #14: 0x00007fff68ce6c8c libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 726
frame #15: 0x00007fff3a9a7b93 AppKit`___NSTouchBarFinderSetNeedsUpdateOnMain_block_invoke + 56
frame #16: 0x00007fff3cd8495d CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #17: 0x00007fff3cd84892 CoreFoundation`__CFRunLoopDoObservers + 452
frame #18: 0x00007fff3cd25c82 CoreFoundation`CFRunLoopRunSpecific + 365
frame #19: 0x00007fff3bfbf895 HIToolbox`RunCurrentEventLoopInMode + 293
frame #20: 0x00007fff3bfbf4d4 HIToolbox`ReceiveNextEventCommon + 371
frame #21: 0x00007fff3bfbf348 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
frame #22: 0x00007fff3a27c95b AppKit`_DPSNextEvent + 997
frame #23: 0x00007fff3a27b6fa AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
frame #24: 0x00007fff3a27575d AppKit`-[NSApplication run] + 699
frame #25: 0x00007fff3a264e97 AppKit`NSApplicationMain + 780
frame #26: 0x000000010004fcd2 ADR ToolBox`main(argc=3, argv=0x00007ffeefbff1e8) at main.m:13
frame #27: 0x00007fff69dc0085 libdyld.dylib`start + 1
frame #28: 0x00007fff69dc0085 libdyld.dylib`start + 1
I occasionally run into a crash with my Mac app, where the debugger stops and catches an EXC_BAD_ACCESS error from main.m. The stack trace looks like as follows:
* thread #1: tid = 0x406ad1, 0x00007fff8be600d7 libobjc.A.dylib`objc_msgSend + 23, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x600036e8de50)
frame #0: 0x00007fff8be600d7 libobjc.A.dylib`objc_msgSend + 23
frame #1: 0x00007fff96edb93b AppKit`_NSPopoverCloseAndAnimate + 1102
frame #2: 0x00007fff9754cfed AppKit`-[NSPopover _geometryInWindowDidChangeForView:] + 166
frame #3: 0x00007fff8bb15cdc CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
frame #4: 0x00007fff8ba07244 CoreFoundation`_CFXNotificationPost + 3140
frame #5: 0x00007fff8ffa6c31 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66
frame #6: 0x00007fff96ca31c1 AppKit`-[NSView _invalidateFocus] + 421
frame #7: 0x00007fff96ca3c32 AppKit`-[NSView removeFromSuperview] + 469
frame #8: 0x00007fff96ea569a AppKit`-[NSWindow dealloc] + 1233
frame #9: 0x00007fff96ca9857 AppKit`-[NSWindow release] + 193
frame #10: 0x00007fff8ba0f9c0 CoreFoundation`CFRelease + 304
frame #11: 0x00007fff8ba23fad CoreFoundation`-[__NSArrayM dealloc] + 205
frame #12: 0x00007fff8be8089c libobjc.A.dylib`objc_object::sidetable_release(bool) + 236
frame #13: 0x00007fff8be66e8f libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 575
frame #14: 0x00007fff8ba31302 CoreFoundation`_CFAutoreleasePoolPop + 50
frame #15: 0x00007fff8ffbfedf Foundation`-[NSAutoreleasePool drain] + 153
frame #16: 0x00007fff96c7e661 AppKit`-[NSApplication run] + 800
frame #17: 0x00007fff96c69a14 AppKit`NSApplicationMain + 1832
frame #18: 0x0000000100003ec2 Contacts Journal Beta`main(argc=3, argv=0x00007fff5fbff670) + 34 at main.m:13
frame #19: 0x00007fff977c35c9 libdyld.dylib`start + 1
I've tried debugging this with NSZombieEnabled and with the Zombies instrument, and they haven't been helpful. But the debugger does stop at this breakpoint (on the rare occasions I run into this crash), so I'm wondering if there is anything I can do with the debugger to get more information as to which object is causing this crash and why.
Would love some lldb tips. Also, is there any way to force the "NSAutoreleasePool drain" that seems to be part of the stack trace? It seems to me that this is the initial cause of the problem, so any fix would have to trigger an autorelease drain (use ARC in my app).
My app works fine on simulator, and worked on the device, but once upon a time it started to crash.
I just get "lldb" error with no messages. When I type "bt" command I see this:
thread #1: tid = 0x24a8, 0x38a1fcc0 libobjc.A.dylibobjc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x38a1fcc0 libobjc.A.dylibobjc_exception_throw
frame #1: 0x2e284bd0 CoreFoundation-[NSException raise] + 8
frame #2: 0x2ebca15e Foundation-[NSObject(NSKeyValueCoding) setValue:forKey:] + 202
frame #3: 0x2ebdbd8c Foundation-[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 300
frame #4: 0x2e1f4a54 CoreFoundation-[NSArray makeObjectsPerformSelector:] + 180
frame #5: 0x30e2553e UIKit-[UINib instantiateWithOwner:options:] + 1122
frame #6: 0x30d7de8e UIKit-[UIViewController _loadViewFromNibNamed:bundle:] + 234
frame #7: 0x30bda344 UIKit-[UIViewController loadView] + 92
frame #8: 0x30aba874 UIKit-[UIViewController loadViewIfRequired] + 72
frame #9: 0x30aba7f0 UIKit-[UIViewController view] + 24
frame #10: 0x30bda276 UIKit-[UIWindow handleStatusBarChangeFromHeight:toHeight:] + 694
frame #11: 0x30b41416 UIKit+[UIWindow _noteStatusBarHeightChanged:oldHeight:forAutolayoutRootViewsOnly:] + 238
frame #12: 0x30c41b10 UIKit__79 - [UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:]_block_invoke + 132
frame #13: 0x30aeba1a UIKit+[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 490
frame #14: 0x30c2431e UIKit+[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:completion:] + 70
frame #15: 0x30b66dca UIKit-[UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:] + 462
frame #16: 0x30ac18e0 UIKit-[UIApplication _updateCurrentStatusBarViewControllerAppearance] + 248
frame #17: 0x30abed72 UIKit-[UIWindow _setHidden:forced:] + 234
frame #18: 0x30b28a30 UIKit-[UIWindow makeKeyAndVisible] + 60
frame #19: 0x30b256c4 UIKit-[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1820
frame #20: 0x30b1fca8 UIKit-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 720
frame #21: 0x30abbc76 UIKit-[UIApplication handleEvent:withNewEvent:] + 3550
frame #22: 0x30abadd8 UIKit-[UIApplication sendEvent:] + 72
frame #23: 0x30b1f3e4 UIKit_UIApplicationHandleEvent + 616
frame #24: 0x33128b54 GraphicsServices_PurpleEventCallback + 608
frame #25: 0x3312873e GraphicsServicesPurpleEventCallback + 34
frame #26: 0x2e24f806 CoreFoundation__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
frame #27: 0x2e24f7a2 CoreFoundation__CFRunLoopDoSource1 + 346
frame #28: 0x2e24df6e CoreFoundation__CFRunLoopRun + 1406
frame #29: 0x2e1b8728 CoreFoundationCFRunLoopRunSpecific + 524
frame #30: 0x2e1b850a CoreFoundationCFRunLoopRunInMode + 106
frame #31: 0x30b1e60a UIKit-[UIApplication _run] + 762
frame #32: 0x30b19870 UIKitUIApplicationMain + 1136
<ul>
<li>frame #33: 0x000e5ed8 SpriteKitSimpleGamemain(argc=1, argv=0x27d62c34) + 116 at main.m:16
I can't understand why it crashes. What may be the reason?
UPD
I've disabled Exception Breakpoints and got the new strange error:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key snewRecordLabel.'
The snewRecordLabel is deleted from the Storyboard UILabel, but it probably is the reason of error. How to remove it?
There is some connection is in storyboard for snewRecordLabel, you can open storyboard into simple textedit & see xml data if you find snewRecordLabel, than there must be missing link will be present in storyboard.
I have a view based NSOutlineView within a NSView. When the view is presented in my app, the outlineview flicker's continuously. awakeFromNib is getting called repeatedly, which contains [myOutlineView reloadData]. However, once I resize the window (hence the view) the flickering subsides and awakeFromNib is no longer being called.
I presume the flickering is caused by the repeated calling of reloadData in awakeFromNib. What I can't determine is why awakeFromNib would be called continuously. I understand that it is called every time a NSTableCellView is created by NSOutline (here), but this doesn't explain why it would be called continuously.
Since this behaviour would stop once I resized the window, I was suspicious of the NSScrollView in which the NSOutlineview is embedded in, but I don't now how to confirm this or more importantly how to fix it.
So can anyone give me some guidance on what could be causing this behaviour?
Edit
This is the stack trace with a break at awakeFromNib, based on this is does look like the creation of a NSTableCellView that calls the awakeFromNib, but why is this done continuously?
frame #1: 0x00007fff8cfd3b5f AppKit`-[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1223
frame #2: 0x00007fff8d077e7c AppKit`-[NSNib _instantiateNibWithExternalNameTable:] + 600
frame #3: 0x00007fff8d19139b AppKit`-[NSNib instantiateNibWithExternalNameTable:] + 17
frame #4: 0x00007fff8d09c278 AppKit`-[NSTableRowData _unarchiveViewWithIdentifier:owner:] + 526
frame #5: 0x00007fff8d09bedd AppKit`-[NSOutlineView makeViewWithIdentifier:owner:] + 48
frame #6: 0x0000000100039c03 Allocator`-[SBRebalanceViewController outlineView:viewForTableColumn:item:](self=0x00006080003c03c0, _cmd=0x00007fff8da60816, outlineView=0x0000000100427ce0, tableColumn=0x000060800009f0e0, item=0x000060000084b580) + 1315 at SBRebalanceViewController.m:146
frame #7: 0x00007fff8d09f964 AppKit`-[NSTableView(NSTableViewViewBased) makeViewForTableColumn:row:] + 77
frame #8: 0x00007fff8d09ec97 AppKit`-[NSTableRowData _addViewToRowView:atColumn:row:] + 305
frame #9: 0x00007fff8d09e9ca AppKit`-[NSTableRowData _addViewsToRowView:atRow:] + 191
frame #10: 0x00007fff8d09babe AppKit`-[NSTableRowData _addRowViewForVisibleRow:withPriorView:] + 421
frame #11: 0x00007fff8d09b83c AppKit`-[NSTableRowData _addRowViewForVisibleRow:withPriorRowIndex:inDictionary:withRowAnimation:] + 278
frame #12: 0x00007fff8d09a906 AppKit`-[NSTableRowData _unsafeUpdateVisibleRowEntries] + 1640
frame #13: 0x00007fff8d09a19c AppKit`-[NSTableRowData updateVisibleRowViews] + 230
frame #14: 0x00007fff8d099dc4 AppKit`-[NSTableView layout] + 165
frame #15: 0x00007fff8d098e1d AppKit`-[NSView _layoutSubtreeWithOldSize:] + 325
frame #16: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #17: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #18: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #19: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #20: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #21: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #22: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #23: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #24: 0x00007fff8d09903e AppKit`-[NSView _layoutSubtreeWithOldSize:] + 870
frame #25: 0x00007fff8d07e584 AppKit`-[NSView layoutSubtreeIfNeeded] + 883
frame #26: 0x00007fff8d746688 AppKit`_NSViewLayoutSubtreesThatUseAutolayoutIfNeeded + 71
frame #27: 0x00007fff8d1097d1 AppKit`-[NSWindow(NSConstraintBasedLayout) _layoutViewTree] + 84
frame #28: 0x00007fff8d139d9d AppKit`-[NSWindow(NSConstraintBasedLayout) layoutIfNeeded] + 214
frame #29: 0x00007fff8d139c86 AppKit`-[NSView _layoutAtWindowLevelIfNeeded] + 80
frame #30: 0x00007fff8d13c3c3 AppKit`-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 48
frame #31: 0x00007fff8d11c2fa AppKit`-[NSView displayIfNeeded] + 1680
frame #32: 0x00007fff8d18174e AppKit`_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints + 884
frame #33: 0x00007fff8d757061 AppKit`__83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke1331 + 46
frame #34: 0x00007fff904efe17 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #35: 0x00007fff904efd87 CoreFoundation`__CFRunLoopDoObservers + 391
frame #36: 0x00007fff904e1468 CoreFoundation`__CFRunLoopRun + 776
frame #37: 0x00007fff904e0f25 CoreFoundation`CFRunLoopRunSpecific + 309
frame #38: 0x00007fff91192a0d HIToolbox`RunCurrentEventLoopInMode + 226
frame #39: 0x00007fff91192685 HIToolbox`ReceiveNextEventCommon + 173
frame #40: 0x00007fff911925bc HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 65
frame #41: 0x00007fff8cfe526e AppKit`_DPSNextEvent + 1434
frame #42: 0x00007fff8cfe48bb AppKit`-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
frame #43: 0x00007fff8cfd89bc AppKit`-[NSApplication run] + 553
frame #44: 0x00007fff8cfc37a3 AppKit`NSApplicationMain + 940
frame #45: 0x0000000100007f02 Allocator`main(argc=7, argv=0x00007fff5fbff7f8) + 34 at main.m:13