libobjc.A.dylib at objc_msgSend:15 crash - ios

Anyone have any insight as to what is causing the following crash?
CLASS:
SIGNAL
FILE:
libobjc.A.dylib at objc_msgSend:15
IOS:
5.1
0libobjc.A.dylib 0x30f7ef78 objc_msgSend 15
1libobjc.A.dylib 0x30f80175 _objc_rootRelease 36
2UIKit 0x3713542d -[UILayoutContainerView _endFastMode] 132
3UIKit 0x37135279 -[UILayoutContainerView setUseFastMode:] 68
4UIKit 0x37090129 -[UIView(FastModeAdditions) _setContainerLayoutViewForFastMode:] 104
5UIKit 0x36ef637b -[UIView dealloc] 574
6UIKit 0x371e0491 -[UIDropShadowView dealloc] 92
7libobjc.A.dylib 0x30f80175 _objc_rootRelease 36
8CoreFoundation 0x36b9c2e7 CFRelease 94
9CoreFoundation 0x36c18b37 __CFDictionaryStandardReleaseValue 70
10CoreFoundation 0x36c6c3bc __CFBasicHashDrain 264
11CoreFoundation 0x36b9c39b CFRelease 274
12libobjc.A.dylib 0x30f81e57 objc_release 38
13libobjc.A.dylib 0x30f80ead _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv 224
14libobjc.A.dylib 0x30f80dc9 _objc_autoreleasePoolPop 12
15CoreFoundation 0x36ba3cff _CFAutoreleasePoolPop 18
16CoreFoundation 0x36c262b3 __CFRunLoopRun 1274
17CoreFoundation 0x36ba94a5 CFRunLoopRunSpecific 300
18CoreFoundation 0x36ba936d CFRunLoopRunInMode 104
19GraphicsServices 0x30c8b439 GSEventRunModal 136
20UIKit 0x36efae7d UIApplicationMain 1080

I would suspect you are releasing an object that is already released (implicitly within the autorelease pool). You need to enable zombies and add breakpoints on objc_exception_throw, etc.
Source: trojanfoe comment

This crash sounds like it happened in UIKit framework while sending the message using objc_msgSend function (part of Objective-C).
You should compile your source code with the debug symbols and generate another more detailed backtrace. Use also debuggers such as dtrace/dtruss to further check problems with your code.
This could be a iOS bug with scrolling as mentioned in here: App crashes when Back button tapped while scrolling table view.
See also: objc_msgSend at ridiculousfish

Related

How do I debug: libc++abi.dylib: terminating with uncaught exception of type NSException?

Sorry for asking this noob question, I know it has been asked thousands of times before, I know because I've had this problem thousands of times before. But this time google isn't helping.
The error / terminal print:
libc++abi.dylib: terminating with uncaught exception of type NSException
I generally know what type of situations cause this because I have had this issue in the past and it was quite simple to fix, usually a misnamed function or a broken link between some UI element and my code, but right now I have no idea what could be causing it.
What I have already tried:
I've added tonnes of breakpoints on the starting ViewController and it goes through all the #IBOutlets without throwing any issues. I've added breakpoints in all the methods in the AppDelegate and it doesn't break anywhere there. The code crashes before it reaches any viewDidLoad() methods. I've cleaned my project, restarted XCode a thousand times and even broken and re-made every link between UI and code. Renamed and then reassigned every #IBAction.
At this point I don't even know what I haven't tried. Every stackoverflow posts is always about the same thing "check broken links etc" but that just isn't helping anymore. I can't remember what it was that I changed because I changed so many small things before I started getting this error. I tried putting everything back but that didn't seem to help.
When the app crashes:
Right after "applicationDidBecomeActve()" is finished the debugger goes into a bunch of machine code, then the app crashes and I get this:
Proof of correct linking:
[Images removed as they were unneccessary]
My main question(s):
If linking is not the issue here, what else could it be?
About NSLogs/stack traces
I would love to provide some sort of NSLog or stack trace as I have seen people ask and give for on other questions but I have no idea how. I cannot find anything on the internet that isn't from the stone age on how to turn them on. And everything else is just how to use the debugger, but I am using the debugger and all I am getting are brief glimpses of my code in a see of machine instructions until it finally just crashes.
EDIT:
Apparently I can only get logs when running on an emulator instead of physical device. Here are the logs I get when running on emulator:
objc[40258]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x123242998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x123067d38). One of the two will be used. Which one is undefined.
2016-11-04 16:26:47.463 KotConnect[40258:1345011] Unknown class ProgressViewContainer in Interface Builder file.
2016-11-04 16:26:47.500 KotConnect[40258:1345011] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIView 0x7fbfe3c0a030> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key loadingView.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001105ca34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011002b21e objc_exception_throw + 48
2 CoreFoundation 0x00000001105ca299 -[NSException raise] + 9
3 Foundation 0x000000010fb3b26f -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x0000000110e0580d -[UIView(CALayerDelegate) setValue:forKey:] + 173
5 UIKit 0x000000011114f79e -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000011056f590 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x000000011114e122 -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x0000000110ee1c21 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9 UIKit 0x0000000110ee2543 -[UIViewController loadView] + 177
10 UIKit 0x0000000110ee2878 -[UIViewController loadViewIfRequired] + 201
11 UIKit 0x0000000110f2307b -[UINavigationController _layoutViewController:] + 55
12 UIKit 0x0000000110f23963 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 471
13 UIKit 0x0000000110f23ada -[UINavigationController _startTransition:fromViewController:toViewController:] + 133
14 UIKit 0x0000000110f24ce5 -[UINavigationController _startDeferredTransitionIfNeeded:] + 874
15 UIKit 0x0000000110f25dc7 -[UINavigationController __viewWillLayoutSubviews] + 58
16 UIKit 0x000000011111cd6f -[UILayoutContainerView layoutSubviews] + 223
17 UIKit 0x0000000110e05f50 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x0000000110ac3cc4 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x0000000110ab7788 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x0000000110ab7606 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x0000000110a45680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x0000000110a72767 _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x0000000110a730d7 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x000000011056ee17 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x000000011056ed87 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x00000001105534b6 CFRunLoopRunSpecific + 454
27 UIKit 0x0000000110d3b7e6 -[UIApplication _run] + 434
28 UIKit 0x0000000110d41964 UIApplicationMain + 159
29 KotConnect 0x000000010d52cc8f main + 111
30 libdyld.dylib 0x00000001135c968d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Swift
Just add
NSSetUncaughtExceptionHandler { exception in
print(exception)
print(exception.callStackSymbols)
}
at the bottom of didFinishLaunchingWithOptions method of AppDelegate. It will give you the better info about the exception occurred.
Happy coding !
Once I was able to see my app log I could see my custom class was not being found. I'll leave the fix I found for this issue for any people who have this issue in the future:
Xcode 6 Strange Bug: Unknown class in Interface Builder file
This happened to me when I accidentaly removed one of my storyboards from my targets. Make sure to double check your Target Membership.

Mysterious crash in iOS 9: -[SKTAppDelegate application:didReceiveLocalNotification:]: unrecognized selector sent to instance

I got a crash report after exercising my app from Crashlytics. I tooks like this:
The full stacktrace as given looks like this:
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 578074103 __exceptionPreprocess
1 libobjc.A.dylib 807402615 objc_exception_throw
2 CoreFoundation 578095805 __methodDescriptionForSelector
3 CoreFoundation 578086961 ___forwarding___
4 CoreFoundation 577239944 _CF_forwarding_prep_0
5 MakeEatSee 2151151 didReceiveLocalNotificationNewImpl
6 UIKit 635813433 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:]
7 UIKit 635780589 -[UIApplication workspace:didReceiveActions:]
8 FrontBoardServices 686207177 __31-[FBSSerialQueue performAsync:]_block_invoke
9 CoreFoundation 577839101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__
10 CoreFoundation 577835713 __CFRunLoopDoBlocks
11 CoreFoundation 577830427 __CFRunLoopRun
12 CoreFoundation 577096497 CFRunLoopRunSpecific
13 CoreFoundation 577096003 CFRunLoopRunInMode
14 GraphicsServices 698237009 GSEventRunModal
15 UIKit 633677553 UIApplicationMain
16 MakeEatSee 502059 main (main.m:14)
17 libdyld.dylib 813284015 start
MakeEatSee is the name of my app. This happened around the time a NSNotification got posted.
I've tested this codepath before, and it's definitely worked before.
I can't make sense of this crash. Reasons being:
There's no mentions of SKTAppDelegate anywhere in the stack trace.
There's no SKTAppDelegate in the codebase, as far as I know. SKT prefix is usually for SupportKit, the old name for Smooch. This, I do use in the app. But there's no , which I do use in the app.
The only mention of SKTAppDelegate leads you to some Apple demo sources
There is no didReceiveLocalNotificationNewImpl method in my app.
Why did this crash happen? What can I do to fix it?
I found out that this is caused by using Smooch iOS SDK 3.0.0. I have updated to the latest version 3.0.1 and this problem appears to have been resolved.

iOS 9 error while running Worklight 6.1 Application

We have tried to run WL 6.1 Fix Pack FP02 app on iOS 9 and got the following error in main.m file:
‘Application windows are expected to have a root view controller at the end of application launch’
The exception is thrown on this line of main.m:
int retVal = UIApplicationMain(argc, argv, appClass, #”MyAppDelegate”);
Any help would be greatly appreciated.
Below is the stack trace from xcode 7 :
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
0 CoreFoundation 0x047e0a94 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0429fe02 objc_exception_throw + 50
2 CoreFoundation 0x047e092a +[NSException raise:format:arguments:] + 138
3 Foundation 0x00f0e3e6 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118
4 UIKit 0x012b3568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3674
5 UIKit 0x012d6905 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3171 + 68
6 UIKit 0x012afbae -[UIApplication workspaceDidEndTransaction:] + 163
7 FrontBoardServices 0x07c1cccc __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
8 FrontBoardServices 0x07c1c7a3 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
9 FrontBoardServices 0x07c3a1cb -[FBSSerialQueue _performNext] + 184
10 FrontBoardServices 0x07c3a602 -[FBSSerialQueue _performNextFromRunLoopSource] + 52
11 FrontBoardServices 0x07c398fe FBSSerialQueueRunLoopSourceHandler + 33
12 CoreFoundation 0x046fae7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
13 CoreFoundation 0x046f0b0b __CFRunLoopDoSources0 + 523
14 CoreFoundation 0x046eff28 __CFRunLoopRun + 1032
15 CoreFoundation 0x046ef866 CFRunLoopRunSpecific + 470
16 CoreFoundation 0x046ef67b CFRunLoopRunInMode + 123
17 UIKit 0x012af497 -[UIApplication _run] + 540
18 UIKit 0x012b4cc1 UIApplicationMain + 160
19 MYAPP 0x00100f5d main + 157
20 libdyld.dylib 0x04c8ba21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Update:
Tested with the provided Hello World project - failing
Tested with the latest available iFix - working
Please upgrade.
Without proper example that can be debugged it is difficult to answer, but it should be noted that for applications compiled with Xcode 7 to correctly function you need to make sure, at minimum, to make the following tweaks:
Disable Bitcode, as it is currently not supported.
Correctly define ATS (either allow all addresses, or correctly setup the client application with HTTPS, and the server with TLS 1.2 support).
Read more about ATS and Bitcode, here: https://developer.ibm.com/mobilefirstplatform/2015/09/09/ats-and-bitcode-in-ios9/
See if that resolves this issue. If not, you must provide an application with reproduction steps.
You should also note that 6.1 Fix Pack 2 is extremely old and you should, as an IBM customer, login to IBM Fix Central and download the latest available iFix (for Studio and Server) and upgrade. This latest iFix also contains iOS 9 related fixes, so it is advised to test with it first, in addition to the above required changes for applications compiled in Xcode 7.
From the provided example project, you are not even using Fix Pack 2, but 1. Even older...
Application windows are expected to have a root view controller at the end of application launch’
This error is caused when there is no view controller for the app to go to after the launch. This could be because you have not created one yet because you started with an empty application, you deleted the view controller, or it might be you deleted the entrance point to the main view controller.

How to find root cause Crashed: com.apple.main-thread in production app?

i have such a report from Crashlytics:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x000000019503fbd0 objc_msgSend + 16
1 CoreFoundation 0x00000001836e5458 CFRelease + 524
2 CoreFoundation 0x00000001836f1a18 -[__NSArrayM dealloc] + 152
3 libobjc.A.dylib 0x0000000195045724 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 564
4 CoreFoundation 0x00000001836e9074 _CFAutoreleasePoolPop + 28
5 Foundation 0x000000018461a588 -[NSAutoreleasePool release] + 148
6 UIKit 0x00000001882b4460 -[UIApplication _run] + 588
7 UIKit 0x00000001882aefac UIApplicationMain + 1488
Is there anything I can do to catch such an issue? It happens on customer devices so I have no chance to reproduce it.
For crashes like this one, if the crash is reproducible, turn on NSZombies in your project's environment variables. This will keep deallocated objects alive (zombies) and when one of them is messaged, the caller and message will be captured on the crashing object.
Turn it off when done as it can block the memory of the app due to the objects not being released for zombie tracking.
Some of logic code need to be run in background. You need to try debug where is code is error and then add this code
DispatchQueue.main.async(execute: {
// your code
})
It's been answered here: objc_msgSend [__NSArrayM dealloc] crash report sometimes from Crashlytics
Basically, upgrade your Crashlytics framework to past 3.0.9. The crash was in the crash reporting framework itself.

low-level iOS crash from UIAlertView _performPopup

I've been getting some low level crashes lately, and this one in particular is hard to determine the origin / state of the app. Has anyone seen this or know the problem? Thanks!
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x3dcccccd
Crashed Thread: 0
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x3dcccccd
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x000025fa objc_msgSend + 18
1 UIKit 0x00162d1c -[UIAlertView(Private) _performPopup:] + 12
2 UIKit 0x001628de -[UIAlertView(Private) _repopup] + 10
3 UIKit 0x0016d196 -[UIAlertView(Private) _removeAlertWindowOrShowAnOldAlert] + 70
4 UIKit 0x00162afa -[UIAlertView(Private) _popoutAnimationDidStop:finished:] + 502
5 UIKit 0x00050ae4 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
6 UIKit 0x000509ee -[UIViewAnimationState animationDidStop:finished:] + 34
7 QuartzCore 0x0002ee8c run_animation_callbacks(double, void*) + 284
8 QuartzCore 0x0002ed2c CA::timer_callback(__CFRunLoopTimer*, void*) + 96
9 CoreFoundation 0x00022d1c CFRunLoopRunSpecific + 2092
10 CoreFoundation 0x000224da CFRunLoopRunInMode + 42
11 GraphicsServices 0x000030d4 GSEventRunModal + 108
12 GraphicsServices 0x00003180 GSEventRun + 56
13 UIKit 0x0000342a -[UIApplication _run] + 374
14 UIKit 0x00001954 UIApplicationMain + 636
15 iPadDrinkHub.1.0.7 0x00002f24 0x1000 + 7972
16 iPadDrinkHub.1.0.7 0x00002ed8 0x1000 + 7896
Weird crashes are sometimes a symptom of memory corruption and/or mismanagement. I just found and fixed a difficult-to-find bug in one of my apps a few days ago. The app had been working flawlessly for 6 months on iOS 3.2, but would crash instantly on iOS 4.2. The crash was happening while adding the main view to the window during applicationDidFinishLaunching. The stack trace showed 100% iOS code; there wasn't a single function of mine in there anywhere (except for applicationDidFinishLaunching). It turned out I was over-releasing a UIImage in code that had been called earlier while views were getting loaded. (I was mistakenly calling release on an autoreleased UIImage).
I haven't seen the specific crash that you're seeing, but here are a few things you can try that may shed some light:
(1) Run the app with NSZombieEnabled. This is an environment variable you set via Xcode that will often identify places where you may be referencing objects that have already been freed (e.g., like the over-release example I mentioned earlier). Additional details are here:
http://www.cocoadev.com/index.pl?NSZombieEnabled
(2) You can turn on logging that will log all messages sent to all objects. The log is a written to a text file in the tmp folder. If you inspect the log file leading up to the crash, you may gain some insight into what's happening right before the crash. This is actually the technique I used to solve my bug. You can either modify your code to enable/disable logging:
instrumentObjcMessageSends(YES);
// Do stuff...
instrumentObjcMessageSends(NO);
Or, you can call the function directly from the debugger. For example, set a breakpoint right before the crash, then drop into the debugger console and do this:
(gdb) call (void)instrumentObjcMessageSends(YES)
Additional details are here:
http://www.dribin.org/dave/blog/archives/2006/04/22/tracing_objc/

Resources