SIGABRT error in Xcode 4.6 - sigabrt

I'm building an app to demonstrate a point for a project and I keep getting the SIGABRT error whenever I run it I have tried using breakpoints but it comes back to the same line of code in main.m:
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
I have typed bt into the debugger and this is what I get:
* thread #1: tid = 0x1c03, 0x96b38a6a libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGABRT
frame #0: 0x96b38a6a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x9244bacf libsystem_c.dylib`pthread_kill + 101
frame #2: 0x04a7657b libsystem_sim_c.dylib`abort + 140
frame #3: 0x04bf6f7b libc++abi.dylib`abort_message + 105
frame #4: 0x04bf4a25 libc++abi.dylib`default_terminate() + 34
frame #5: 0x010cf0c1 libobjc.A.dylib`_objc_terminate() + 94
frame #6: 0x04bf4a65 libc++abi.dylib`safe_handler_caller(void (*)()) + 13
frame #7: 0x04bf4acd libc++abi.dylib`std::terminate() + 23
frame #8: 0x04bf5c4e libc++abi.dylib`__cxa_rethrow + 83
frame #9: 0x010cefbd libobjc.A.dylib`objc_exception_rethrow + 47
frame #10: 0x01c36f98 CoreFoundation`CFRunLoopRunSpecific + 360
frame #11: 0x01c36e1b CoreFoundation`CFRunLoopRunInMode + 123
frame #12: 0x0001117a UIKit`-[UIApplication _run] + 774
frame #13: 0x00012ffc UIKit`UIApplicationMain + 1211
frame #14: 0x000021bd Scooter App`main(argc=1, argv=0xbffff378) + 141 at main.m:16
All help will be gratefully received.

Related

Xcode 12.1 Debugging EXC_BAD_ACCESS

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

Steps to diagnose KVO crash in macOS Cocoa App

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

Crash with EXC_BAD_ACCESS in Xcode - debugging

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).

How to solve the lldb error in Xcode?

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.

NSSplitView crash when delegate assigned

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?

Resources