How to decode a Message sent to deallocated instance error - ios

I am running into a strange crash I'm having issues debugging. My scheme has both zombies and address sanatizer enabled.
I'm getting the error:
2015-09-05 06:56:16.240 asgaard[486:110984] *** -[CFString
boundingRectWithSize:options:attributes:context:]: message sent to
deallocated instance 0x1897b210
which is pretty unhelpful to me as its breaking on some assembly code.
I tried the memory history command which I'm not sure is what i need and got the following output:
thread #4294967295: tid = 0x0000, 0x00b39fb0 libclang_rt.asan_ios_dynamic.dylib`__asan_mz_malloc + 116, name = 'Memory allocated at'
frame #0: 0x00b39fb0 libclang_rt.asan_ios_dynamic.dylib`__asan_mz_malloc + 116
frame #1: 0x33587da6 libsystem_malloc.dylib`malloc_zone_malloc + 86
frame #2: 0x2471f982 CoreFoundation`_CFRuntimeCreateInstance + 290
frame #3: 0x247f3162 CoreFoundation`__CFStringCreateImmutableFunnel3 + 1718
frame #4: 0x2473962c CoreFoundation`CFStringCreateCopy + 396
frame #5: 0x247f33d6 CoreFoundation`_CFStringCreateWithFormatAndArgumentsAux2 + 86
frame #6: 0x25496a70 Foundation`-[NSPlaceholderString initWithFormat:locale:arguments:] + 136
frame #7: 0x25496972 Foundation`+[NSString stringWithFormat:] + 58
frame #8: 0x001ef70c asgaard`-[ActiveRecordingViewController updateSpeeds](self=<unavailable>, _cmd=<unavailable>) + 836 at ActiveRecordingViewController.m:578
frame #9: 0x001edd20 asgaard`__51-[ActiveRecordingViewController ahrswNotification:]_block_invoke(.block_descriptor=<unavailable>) + 192 at ActiveRecordingViewController.m:456
frame #10: 0x00b38ef0 libclang_rt.asan_ios_dynamic.dylib`__wrap_dispatch_async_block_invoke + 160
frame #11: 0x03273170 libdispatch.dylib`_dispatch_call_block_and_release + 8
frame #12: 0x0327315c libdispatch.dylib`_dispatch_client_callout + 20
frame #13: 0x03276e42 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1510
frame #14: 0x247e63e6 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 6
frame #15: 0x247e4ae6 CoreFoundation`__CFRunLoopRun + 1510
frame #16: 0x24730f2e CoreFoundation`CFRunLoopRunSpecific + 474
frame #17: 0x24730d40 CoreFoundation`CFRunLoopRunInMode + 104
frame #18: 0x2c0f91fe GraphicsServices`GSEventRunModal + 134
frame #19: 0x27f02876 UIKit`UIApplicationMain + 1438
frame #20: 0x00129b0a asgaard`main(argc=<unavailable>, argv=<unavailable>) + 106 at main.m:13
frame #21: 0x33499aac libdyld.dylib`tlv_initializer + 4
I'm a little lost here exactly what this message is telling me.
frame #8: 0x001ef70c asgaard`-[ActiveRecordingViewController updateSpeeds](self=<unavailable>, _cmd=<unavailable>) + 836 at ActiveRecordingViewController.m:578
Frame 8 is a function I wrote - and it is running in an async loop on the main thread - could that somehow be connected to this error?
The actual code line is:
578: [self coreGroundSpeed].text = [NSString stringWithFormat:#"%d Kts", coreSpd];
Any suggestions where/what to look at?

Related

I just upgraded to Xcode 9.3 gives Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

My project was working absolutely fine, until the upgrade to 9.3. Right after the upgrade I started seeing the EXC_BAD_ACCESS error at my AppDelegate class.
I'm new to IOS development and this is my first Xcode update, are there any steps that I'm supposed to do to make sure my projects don't break like this on every update?
I'm using the Spotify API to mimic an instagram like feed and play songs from spotify on each post. Here is the bt
2018-04-04 22:32:08.479489-0400 Project2[43968:2765723] CreateMetadataFromXMPBufferInternal:566: Threw error #201 (XML parsingfailure)
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000109f772cf libswiftCore.dylib`swift_getObjectType +47
frame #1: 0x0000000104b38e58 Project2`#objcAppDelegate.application(_:open:sourceApplication:annotation:) at AppDelegate.swift:0
frame #2: 0x0000000107adc33f UIKit`__58-[UIApplication_applicationOpenURLAction:payload:origin:]_block_invoke + 1037
frame #3: 0x0000000107adbc31 UIKit`-[UIApplication _applicationOpenURLAction:payload:origin:] + 652
frame #4: 0x0000000107ae8eff UIKit`-[UIApplication_handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 4851
frame #5: 0x0000000107e9466d UIKit`-[__UICanvasLifecycleMonitor_CompatabilityactivateEventsOnly:withContext:completion:] + 1641
frame #6: 0x00000001088054d4 UIKit`__82-[_UIApplicationCanvas_transitionLifecycleStateWithTransitionContext:completion:] _block_invoke + 299
frame #7: 0x000000010880536e UIKit`-[_UIApplicationCanvas_transitionLifecycleStateWithTransitionContext:completion:] + 433
frame #8: 0x00000001084e962d UIKit`__125- [_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff: fromSettings:transitionContext:]_block_invoke + 221
frame #9: 0x00000001086e4387UIKit`_performActionsWithDelayForTransitionContext + 100
frame #10: 0x00000001084e94f7 UIKit`- [_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
frame #11: 0x0000000108265fb0 UIKit`-[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
frame #12: 0x00000001080a2f89 UIKit`-[UIApplicationSceneClientAgentscene:handleEvent:withCompletion:] + 502
frame #13: 0x000000011094ed2d FrontBoardServices`__80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 + 198
frame #14: 0x000000010ac2c848 libdispatch.dylib`_dispatch_client_callout + 8
frame #15: 0x000000010ac31e14 libdispatch.dylib`_dispatch_block_invoke_direct + 592
frame #16: 0x0000000110982470 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
frame #17: 0x000000011098212e FrontBoardServices`-[FBSSerialQueue _performNext] + 439
frame #18: 0x000000011098268e FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 45
frame #19: 0x0000000106944bb1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
frame #20: 0x00000001069294af CoreFoundation`__CFRunLoopDoSources0 +271
frame #21: 0x0000000106928a6f CoreFoundation`__CFRunLoopRun + 1263
frame #22: 0x000000010692830b CoreFoundation`CFRunLoopRunSpecific + 635
frame #23: 0x000000010da7aa73 GraphicsServices`GSEventRunModal + 62
frame #24: 0x0000000107ad30b7 UIKit`UIApplicationMain + 159
* frame #25: 0x0000000104b393f7 Project2`main at AppDelegate.swift:12
frame #26: 0x000000010aca9955 libdyld.dylib`start + 1
(lldb)
Can someone help please? Has anyone seen anything of this sort?

Getting error "-[NSThread threadDictionary]: message sent to deallocated instance"

Sometime after writing code to my project, I noticed the debugger would pause my application and put lldb in the console and couldn't let me continue. I used NSZombies and I got this message : "-[NSThread threadDictionary]: message sent to deallocated instance". I have looked around but couldn't find any help what is causing this. When I print the backtrace I get:
thread #17: tid = 0x7886f, 0x0000000180f7ab40 CoreFoundation`___forwarding___ + 700, stop reason = EXC_BREAKPOINT (code=1, subcode=0x180f7ab40)
frame #0: 0x0000000180f7ab40 CoreFoundation`___forwarding___ + 700
frame #1: 0x0000000180e78c5c CoreFoundation`_CF_forwarding_prep_0 + 92
frame #2: 0x00000001860536dc UIFoundation`+[NSStringDrawingTextStorageSettings threadSpecificStringDrawingTextStorageSettings:] + 64
frame #3: 0x000000018604900c UIFoundation`+[NSString(NSStringDrawing) typesetterBehavior] + 32
frame #4: 0x000000018604a6d4 UIFoundation`__NSStringDrawingEngine + 244
frame #5: 0x000000018604a4d0 UIFoundation`-[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 176
frame #6: 0x00000001860eb564 UIKit`-[UILabel _drawTextInRect:baselineCalculationOnly:] + 3856
frame #7: 0x000000018615e8f0 UIKit`-[UILabel drawTextInRect:] + 544
frame #8: 0x000000018615e678 UIKit`-[UIView(CALayerDelegate) drawLayer:inContext:] + 368
frame #9: 0x0000000183a92230 QuartzCore`-[CALayer drawInContext:] + 260
frame #10: 0x0000000183a7c8b4 QuartzCore`CABackingStoreUpdate_ + 2432
frame #11: 0x0000000183b94360 QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 52
frame #12: 0x0000000183a7ba90 QuartzCore`CA::Layer::display_() + 1368
frame #13: 0x0000000183a5d7b0 QuartzCore`CA::Layer::display_if_needed(CA::Transaction*) + 228
frame #14: 0x0000000183a5d49c QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 44
frame #15: 0x0000000183a5cac0 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 252
frame #16: 0x0000000183a5c820 QuartzCore`CA::Transaction::commit() + 500
frame #17: 0x0000000183a8bbd4 QuartzCore`CA::Transaction::release_thread(void*) + 236
frame #18: 0x0000000180bda1e0 libsystem_pthread.dylib`_pthread_tsd_cleanup + 584
frame #19: 0x0000000180bd9d58 libsystem_pthread.dylib`_pthread_exit + 136
frame #20: 0x0000000180bd953c libsystem_pthread.dylib`_pthread_wqthread + 1296
frame #21: 0x0000000180bd9020 libsystem_pthread.dylib`start_wqthread + 4
Any help to find out whats going on will help tremendously!
Found out the problem was I had a label with a weak reference. I was hiding it for to long and it seems the garbage collection cleaned in up. So when I tried to send data to it, it was already dealloc.
Somewhere you are calling an instance method of any class and class object is nil.

Navigation to Different view results in SIGABRT error

I am new to Objective C, and cannot figure out the error I am facing right now. The app was developed by some other developer few years back, and I just have to change some images and upload back as new version (and underline API/webservice got updated). Everything was done fine, but one button in app is causing a crash.
We have two button in our main interface, one shows the listing near by user location, which works, and we have another to show all listing. The calling method for them is same, but when we use Show all listing interface in code it crash application with no error. in Debugger it shows (lldb) and generate SIGABRT in main appdelegate call.
Here is the button code
-(IBAction)btnAllResturantAction:(id)sender
{
[btnAllRestaruant setImage:[UIImage imageNamed:#"all_restaurants_tapped.png"] forState:UIControlStateNormal];
NSLog(#"SearchView : Button CLick for All Resturant");
#try {
HomeViewController *homeView1=[[HomeViewController alloc]initWithNibName:#"HomeViewController" bundle:nil];
[self.navigationController pushViewController:homeView1 animated:YES];
NSLog(#"SearchView: Button CLick complete");
} #catch (NSException *exception){
NSLog(#"Search View: Exception in All Resturant %#", exception.reason);
}
}
When in line by line debug, I can see Log message of "Button Click complete" visible in debugger window, but just after that it fail and crash application, I didn't see any other error message even after I try bt in Debugger window, it shows all framework code. Here is bt result anyways
* thread #1: tid = 0x129d3, 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0464e62a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x04617664 libsystem_pthread.dylib`pthread_kill + 101
frame #2: 0x043c539d libsystem_c.dylib`abort + 156
frame #3: 0x002ff065 project6`uncaught_exception_handler + 38
frame #4: 0x03eabebe CoreFoundation`__handleUncaughtException + 830
frame #5: 0x0396d0ae libobjc.A.dylib`_objc_terminate() + 100
frame #6: 0x04687d0d libc++abi.dylib`std::__terminate(void (*)()) + 14
frame #7: 0x0468793e libc++abi.dylib`__cxa_rethrow + 103
frame #8: 0x0396cfad libobjc.A.dylib`objc_exception_rethrow + 47
frame #9: 0x03dba7d0 CoreFoundation`CFRunLoopRunSpecific + 672
frame #10: 0x03dba51b CoreFoundation`CFRunLoopRunInMode + 123
frame #11: 0x056ef664 GraphicsServices`GSEventRunModal + 192
frame #12: 0x056ef4a1 GraphicsServices`GSEventRun + 104
frame #13: 0x006941eb UIKit`UIApplicationMain + 160
frame #14: 0x000abf7a project6`main(argc=1, argv=0xbff5587c) + 138 at main.m:14
frame #15: 0x0431ea21 libdyld.dylib`start + 1
Can you guide me where and how I look for error, with this information.
EDIT:
I add Exception Breakpoint which generate this bt
(lldb) bt
thread #1: tid = 0x1368d, 0x03996dd0 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
frame #0: 0x03996dd0 libobjc.A.dylib`objc_exception_throw
frame #1: 0x03ed59ad CoreFoundation`+[NSException raise:format:] + 141
frame #2: 0x008873cb UIKit`-[UIViewController _loadViewFromNibNamed:bundle:] + 740
frame #3: 0x00887ccc UIKit`-[UIViewController loadView] + 189
frame #4: 0x008880d8 UIKit`-[UIViewController loadViewIfRequired] + 154
frame #5: 0x0088ebde UIKit`-[UIViewController __viewWillAppear:] + 114
frame #6: 0x008b1d37 UIKit`-[UIViewController(UIContainerViewControllerProtectedMethods) beginAppearanceTransition:animated:] + 202
frame #7: 0x008c4009 UIKit`-[UINavigationController _startCustomTransition:] + 1389
frame #8: 0x008d5bf5 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 803
frame #9: 0x008d6e3b UIKit`-[UINavigationController __viewWillLayoutSubviews] + 68
frame #10: 0x00ab2193 UIKit`-[UILayoutContainerView layoutSubviews] + 252
frame #11: 0x00787eb7 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 813
frame #12: 0x039ab059 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #13: 0x0586780a QuartzCore`-[CALayer layoutSublayers] + 144
frame #14: 0x0585b4ee QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 388
frame #15: 0x0585b352 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #16: 0x0584de8b QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 317
frame #17: 0x05881e03 QuartzCore`CA::Transaction::commit() + 561
frame #18: 0x05883674 QuartzCore`CA::Transaction::flush_transaction() + 50
frame #19: 0x006b7f0a UIKit`_UIApplicationHandleEventQueue + 8398
frame #20: 0x03defd1f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
frame #21: 0x03de59ab CoreFoundation`__CFRunLoopDoSources0 + 523
frame #22: 0x03de4dc8 CoreFoundation`__CFRunLoopRun + 1032
frame #23: 0x03de4706 CoreFoundation`CFRunLoopRunSpecific + 470
frame #24: 0x03de451b CoreFoundation`CFRunLoopRunInMode + 123
frame #25: 0x05719664 GraphicsServices`GSEventRunModal + 192
frame #26: 0x057194a1 GraphicsServices`GSEventRun + 104
frame #27: 0x006be1eb UIKit`UIApplicationMain + 160
frame #28: 0x000d5f7a project6`main(argc=1, argv=0xbff2b87c) + 138 at main.m:14
frame #29: 0x04348a21 libdyld.dylib`start + 1

[UIView _forgetDependentConstraint:]: message sent to deallocated instance

I tried using NSZobie and all others. Still i face issues. can't able to find where app crashed. Please Help. thanks in advance.
*** -[UIView _forgetDependentConstraint:]: message sent to deallocated instance 0x208e0010
(lldb) bt
* thread #1: tid = 0x2503, 0x342b3468 CoreFoundation`___forwarding___ + 192, stop reason = EXC_BREAKPOINT (code=EXC_ARM_B`enter code here`REAKPOINT, subcode=0xdefe)
frame #0: 0x342b3468 CoreFoundation`___forwarding___ + 192
frame #1: 0x3420af68 CoreFoundation`__forwarding_prep_0___ + 24
frame #2: 0x364f24ba UIKit`_updateViewDependenciesForConstraint + 202
frame #3: 0x364f9a2c UIKit`__72-[UIView(AdditionalLayoutSupport) _removeRelevantConstraintsFromEngine:]_block_invoke_0 + 264
frame #4: 0x34c65882 Foundation`-[NSISEngine withAutomaticOptimizationDisabled:] + 166
frame #5: 0x364f98ee UIKit`-[UIView(AdditionalLayoutSupport) _removeRelevantConstraintsFromEngine:] + 94
frame #6: 0x3629f4a0 UIKit`__UIViewWillBeRemovedFromSuperview + 588
frame #7: 0x360e7848 UIKit`-[UIView(Hierarchy) removeFromSuperview] + 56
frame #8: 0x36137f18 UIKit`-[UINavigationTransitionView _cleanupTransition] + 92
frame #9: 0x360ceab2 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 158
frame #10: 0x361438ee UIKit`-[UIViewAnimationState animationDidStop:finished:] + 50
frame #11: 0x35e78c00 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 208
frame #12: 0x3c3f04b6 libdispatch.dylib`_dispatch_client_callout + 22
frame #13: 0x3c3f51bc libdispatch.dylib`_dispatch_main_queue_callback_4CF$VARIANT$mp + 224
frame #14: 0x34284f3a CoreFoundation`__CFRunLoopRun + 1290
frame #15: 0x341f7ebc CoreFoundation`CFRunLoopRunSpecific + 356
frame #16: 0x341f7d48 CoreFoundation`CFRunLoopRunInMode + 104
frame #17: 0x37dd02ea GraphicsServices`GSEventRunModal + 74
frame #18: 0x3610d300 UIKit`UIApplicationMain + 1120
frame #19: 0x000521de MyApp®`main(argc=1, argv=0x2fdb3cf8) + 162 at main.m:6
frame #20: 0x3c410b20 libdyld.dylib`start + 4
Check if you have UIAlertView or animations in view before came back to your view. It seems you are initalize a view with it's local variable, wihout having express use self delegate, or you use removeFromSuperview for a view while actions still call it after remove.

How to fix MP3AudioStream error?

I'm getting the following error randomly (and sometimes consistently on launch). It can happen when there are background threads and when there aren't and it seems to be a problem with the library so I'm having trouble tracking down the problem in my code. The breakpoint triggers on:
#0 0x07bb489b in MP3AudioStream::GeneratePackets(AudioFileStreamContinuation&) ()
and the backtrace is as follows:
* thread #1: tid = 0x1c03, 0x07bb489b AudioToolbox`MP3AudioStream::GeneratePackets(AudioFileStreamContinuation&) + 2843, stop reason = EXC_BAD_ACCESS (code=2, address=0x4)
frame #0: 0x07bb489b AudioToolbox`MP3AudioStream::GeneratePackets(AudioFileStreamContinuation&) + 2843
frame #1: 0x07b92535 AudioToolbox`AudioFileStreamWrapper::ParseBytes(unsigned long, void const*, unsigned long) + 181
frame #2: 0x07b8f41d AudioToolbox`AudioFileStreamParseBytes + 93
frame #3: 0x07f7a1be MediaToolbox`PushBytesThroughParser + 484
frame #4: 0x07f7a69a MediaToolbox`GetAudioFileStreamPacketAndFrameCount + 221
frame #5: 0x07f7c57e MediaToolbox`FigAudioFileStreamFormatReaderCopyProperty + 225
frame #6: 0x07f9bd1d MediaToolbox`FigPlaybackBossGetDuration + 165
frame #7: 0x07f9f75a MediaToolbox`FigPlaybackBossSetTimeWithRange + 192
frame #8: 0x07f66bef MediaToolbox`itemfig_rebuildRenderPipelinesAndBoss + 10196
frame #9: 0x07f63f01 MediaToolbox`playerfig_prepareWorkingItem2 + 117
frame #10: 0x07f5bdb9 MediaToolbox`playerfig_prepareWorkingItem + 88
frame #11: 0x07f6c536 MediaToolbox`itemfig_assetPropertyBatchLoaded_prepareWorkingItem + 125
frame #12: 0x01bc8758 CoreMedia`figDeferredNotificationRun + 69
frame #13: 0x01de4376 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
frame #14: 0x01de3e06 CoreFoundation`__CFRunLoopDoTimer + 534
frame #15: 0x01dcba82 CoreFoundation`__CFRunLoopRun + 1810
frame #16: 0x01dcaf44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #17: 0x01dcae1b CoreFoundation`CFRunLoopRunInMode + 123
frame #18: 0x02afb7e3 GraphicsServices`GSEventRunModal + 88
frame #19: 0x02afb668 GraphicsServices`GSEventRun + 104
frame #20: 0x00330ffc UIKit`UIApplicationMain + 1211
frame #21: 0x00002a7d FMA`main(argc=1, argv=0xbffff3f0) + 141 at main.m:16
Has anyone had this error and does anyone know how I might go about fixing it?

Resources