I'm newbie in Swift and I'm currenlty trying to learn it but I faced a mystery issue. As you can see in the image below, there are some controls that are linked properly to this View Controller and upon pressing a button in the UI we execute this code below but I always got an EXC_BAD_INSTRUCTION. I don't understand why!!
Here is some info from the stack trace.
(lldb) thread info
thread #1: tid = 0x9319, 0x0006c5d5 App`App.AViewController.sendCommentViaEmail (self=<unavailable>)() -> () + 9349 at AViewController.swift:49, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
(lldb) frame select 1
frame #1: 0x037067cd libobjc.A.dylib`-[NSObject performSelector:withObject:withObject:] + 84
libobjc.A.dylib`-[NSObject performSelector:withObject:withObject:] + 84:
-> 0x37067cd: addl $0x1c, %esp
0x37067d0: popl %esi
0x37067d1: popl %edi
0x37067d2: popl %ebx
EDITED:
Stacktrace below
* thread #1: tid = 0x1e19, 0x0005a5d5 A`A.AViewController.sendCommentViaEmail (self=<unavailable>)() -> () + 9349 at AViewController.swift:49, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
* frame #0: 0x0005a5d5 A`A.AViewController.sendCommentViaEmail (self=<unavailable>)() -> () + 9349 at AViewController.swift:49
frame #1: 0x036f47cd libobjc.A.dylib`-[NSObject performSelector:withObject:withObject:] + 84
frame #2: 0x01ea323d UIKit`-[UIApplication sendAction:to:from:forEvent:] + 99
frame #3: 0x02213840 UIKit`-[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139
frame #4: 0x036f47cd libobjc.A.dylib`-[NSObject performSelector:withObject:withObject:] + 84
frame #5: 0x01ea323d UIKit`-[UIApplication sendAction:to:from:forEvent:] + 99
frame #6: 0x01ea31cf UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
frame #7: 0x01fd6e86 UIKit`-[UIControl sendAction:to:forEvent:] + 69
frame #8: 0x01fd72a3 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 598
frame #9: 0x01fd650d UIKit`-[UIControl touchesEnded:withEvent:] + 660
frame #10: 0x01ef360a UIKit`-[UIWindow _sendTouchesForEvent:] + 874
frame #11: 0x01ef40e5 UIKit`-[UIWindow sendEvent:] + 791
frame #12: 0x01eb9549 UIKit`-[UIApplication sendEvent:] + 242
frame #13: 0x01ec937e UIKit`_UIApplicationHandleEventFromQueueEvent + 20690
frame #14: 0x01e9db19 UIKit`_UIApplicationHandleEventQueue + 2206
frame #15: 0x039791df CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
frame #16: 0x0396eced CoreFoundation`__CFRunLoopDoSources0 + 253
frame #17: 0x0396e248 CoreFoundation`__CFRunLoopRun + 952
frame #18: 0x0396dbcb CoreFoundation`CFRunLoopRunSpecific + 443
frame #19: 0x0396d9fb CoreFoundation`CFRunLoopRunInMode + 123
frame #20: 0x085dc24f GraphicsServices`GSEventRunModal + 192
frame #21: 0x085dc08c GraphicsServices`GSEventRun + 104
frame #22: 0x01ea18b6 UIKit`UIApplicationMain + 1526
frame #23: 0x000919cc A`main(argc=1, argv=0xbffaa62c) + 76 at main.m:12
frame #24: 0x04490ac9 libdyld.dylib`start + 1
Here are the properties I'm using:
I got the same result whether they are linked to the UI or not.
Where does emailToMyselfSwitch come from? If it's an IBOutlet it seems that you forgot to connect it from IB to your code. If that's not the case please show more context.
This error EXC_BAD_INSTRUCTION generally means that you are calling a property or method (selector?) on a null object or an object that can't respond to the selector ie self.null.on or a property that cannot be accessed because it was released.
I've had trouble in the past with these weak vars falling away. Try deleting the weak in your property.
your code is correct. The problem is not in the connection with outlet. I´ve tested and prints: "Value: nil"
The problem is in other part of code.
The message "self=" is not normal.
You can show us more information.
Related
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?
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.
I have a piece of code which runs correctly in real device but is giving EXC_BAD_ACCESS (code=1, address=0x0) error in simulator (iphone 6) :
The bt output is:
(lldb) bt
* thread #1: tid = 0xe40f6, 0x00000001052ab5e9 CoreFoundation`CFArrayGetCount + 25, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001052ab5e9 CoreFoundation`CFArrayGetCount + 25
* frame #1: 0x0000000104c6a5af MyApp`static MyApp.SSID.fetchSSIDInfo (self=MyApp.SSID)() -> Swift.String + 95 at WifiGetter.swift:17
frame #2: 0x0000000104c4994a MyApp`MyApp.TableViewController.sendWifi (self=0x00007ff05a64da80)() -> () + 26 at TableViewController.swift:355
frame #3: 0x0000000104c49316 MyApp`MyApp.TableViewController.fetchData (self=0x00007ff05a64da80)() -> () + 38 at TableViewController.swift:308
frame #4: 0x0000000104c4567f MyApp`MyApp.TableViewController.viewDidLoad (self=0x00007ff05a64da80)() -> () + 3215 at TableViewController.swift:66
frame #5: 0x0000000104c45ea2 MyApp`#objc MyApp.TableViewController.viewDidLoad (MyApp.TableViewController)() -> () + 34 at TableViewController.swift:0
frame #6: 0x00000001063c9931 UIKit`-[UIViewController loadViewIfRequired] + 1344
frame #7: 0x000000010640cc26 UIKit`-[UINavigationController _layoutViewController:] + 54
frame #8: 0x000000010640d4dd UIKit`-[UINavigationController _updateScrollViewFromViewController:toViewController:] + 433
frame #9: 0x000000010640d633 UIKit`-[UINavigationController _startTransition:fromViewController:toViewController:] + 116
frame #10: 0x000000010640e879 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 890
frame #11: 0x000000010640f67d UIKit`-[UINavigationController __viewWillLayoutSubviews] + 57
frame #12: 0x00000001065a763d UIKit`-[UILayoutContainerView layoutSubviews] + 248
frame #13: 0x00000001062ef11c UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710
frame #14: 0x000000010c35836a QuartzCore`-[CALayer layoutSublayers] + 146
frame #15: 0x000000010c34cbd0 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 366
frame #16: 0x000000010c34ca4e QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
frame #17: 0x000000010c3411d5 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 277
frame #18: 0x000000010c36e9f0 QuartzCore`CA::Transaction::commit() + 508
frame #19: 0x000000010c36f154 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #20: 0x00000001053079d7 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #21: 0x0000000105307947 CoreFoundation`__CFRunLoopDoObservers + 391
frame #22: 0x00000001052fcebc CoreFoundation`CFRunLoopRunSpecific + 524
frame #23: 0x000000010623998d UIKit`-[UIApplication _run] + 402
frame #24: 0x000000010623e676 UIKit`UIApplicationMain + 171
frame #25: 0x0000000104c20efd MyApp`main + 109 at AppDelegate.swift:20
frame #26: 0x0000000108ea592d libdyld.dylib`start + 1
interfaces is nil. You must handle this case. I recommend avoiding !. Making the type non-optional here will allow the if let binding to work correctly.
You should change your if let clause to if let interfaces = CNCopySupportedInterfaces() as? CFArray.
Because you use if let interfaces: CFArray! with ! mean force unwrap, therefore, when CNCopySupportedInterfaces() return nil or value which is not convertible to CFArray, force unwrap will cause crash
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
I have an application that pulls JSON data from a server, parses the data into NSManagedObject subclasses and these NSManagedObject subclasses are then used as properties in various view controllers.
The trouble I'm having is that at some point in the future the data on the server will change and this will trigger an update pull request. When attempting to update the NSManagedObject subclasses, the app is crashing if the user then attempts to modify NSManagedObject via the UI by e.g. answering a question which updates a relationship on that NSManagedObject.
Is it possible to use NSManagedObject to both display data to the user and at the same time update that NSManagedObject's record on a different thread?
This is the backtrace that I'm getting after the error:
* thread #1: tid = 0x1c03, 0x003d5e6d libsqlite3.dylib`sqlite3VdbeExec + 54749, stop reason = EXC_BAD_ACCESS (code=2, address=0x0)
frame #0: 0x003d5e6d libsqlite3.dylib`sqlite3VdbeExec + 54749
frame #1: 0x00343be1 libsqlite3.dylib`sqlite3_step + 3169
frame #2: 0x0071419f CoreData`_execute + 143
frame #3: 0x00714011 CoreData`-[NSSQLiteConnection execute] + 2801
frame #4: 0x007285ce CoreData`-[NSSQLChannel selectRowsWithStatement:] + 94
frame #5: 0x0073128f CoreData`newFetchedRowsForFetchPlan_MT + 1279
frame #6: 0x0071c6e3 CoreData`-[NSSQLCore newRowsForFetchPlan:] + 323
frame #7: 0x0071be07 CoreData`-[NSSQLCore objectsForFetchRequest:inContext:] + 711
frame #8: 0x0071b8f4 CoreData`-[NSSQLCore executeRequest:withContext:error:] + 404
frame #9: 0x0071aa6d CoreData`-[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 2445
frame #10: 0x007189c9 CoreData`-[NSManagedObjectContext executeFetchRequest:error:] + 569
frame #11: 0x0002f7a4 TQ`+[QTQCoreDataManager retrieveAllEntriesForEntityName:stringPredicate:orderBy:ascendingOrder:managedObjectContext:] + 532 at QTQCoreDataManager.m:103
frame #12: 0x0002fbcb TQ`+[QTQCoreDataManager retrieveFirstEntryForEntityName:stringPredicate:orderBy:ascendingOrder:managedObjectContext:] + 203 at QTQCoreDataManager.m:149
frame #13: 0x0002faa2 TQ`+[QTQCoreDataManager retrieveFirstEntryForEntityName:stringPredicate:orderBy:ascendingOrder:] + 226 at QTQCoreDataManager.m:129
frame #14: 0x000dd65e TQ`-[QTQTopic latestAnsweredSession] + 238 at QTQTopic.m:228
frame #15: 0x000dca29 TQ`-[QTQTopic isCompleted] + 185 at QTQTopic.m:157
frame #16: 0x000b5362 TQ`-[QTQTopicContainerViewController closeButtonPressed:] + 1442 at QTQTopicContainerViewController.m:376
frame #17: 0x01be2705 libobjc.A.dylib`-[NSObject performSelector:withObject:withObject:] + 77
frame #18: 0x00b19920 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 96
frame #19: 0x00b198b8 UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
frame #20: 0x00bda671 UIKit`-[UIControl sendAction:to:forEvent:] + 66
frame #21: 0x00bdabcf UIKit`-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578
frame #22: 0x00bd9d38 UIKit`-[UIControl touchesEnded:withEvent:] + 546
frame #23: 0x00b4933f UIKit`-[UIWindow _sendTouchesForEvent:] + 846
frame #24: 0x00b49552 UIKit`-[UIWindow sendEvent:] + 273
frame #25: 0x00b273aa UIKit`-[UIApplication sendEvent:] + 436
frame #26: 0x00b18cf8 UIKit`_UIApplicationHandleEvent + 9874
frame #27: 0x02e47df9 GraphicsServices`_PurpleEventCallback + 339
frame #28: 0x02e47ad0 GraphicsServices`PurpleEventCallback + 46
frame #29: 0x02166bf5 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
frame #30: 0x02166962 CoreFoundation`__CFRunLoopDoSource1 + 146
frame #31: 0x02197bb6 CoreFoundation`__CFRunLoopRun + 2118
frame #32: 0x02196f44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #33: 0x02196e1b CoreFoundation`CFRunLoopRunInMode + 123
frame #34: 0x02e467e3 GraphicsServices`GSEventRunModal + 88
frame #35: 0x02e46668 GraphicsServices`GSEventRun + 104
frame #36: 0x00b1665c UIKit`UIApplicationMain + 1211
frame #37: 0x00005fcd TQ`main + 141 at main.m:16
kinda.. not the same MO but the same entity.
the thing is that MOs aren't threadsafe but objectIDs are
so...
get the MO in main thread for UI
get its ObjectID and use it in bg thread
(fetch it again here)
update the object after you are done in main thread (call [context refreshObject:object])