Crash with NSManagedObject release: "objc_msgSend() selector name: _queueForDealloc" - ios

I have been getting a strange crash reported by lots of users through HockeyApp with the following stack trace. It seems to have something to do with NSManagedObject being released in a different dispatch queue ... but I don't get any symbolication for where the problem might be. It seems like a memory management issue, but I'm using ARC so not sure how it would over-release an NSManagedObject.
This is the crash report I get (the main thread shows different traces at different times):
Code Type: ARM-64
Parent Process: launchd [1]
Date/Time: 2014-05-12T05:43:54Z
OS Version: iPhone OS 7.0.6 (11B651)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x1c3dbeb8
Crashed Thread: 2
Application Specific Information:
objc_msgSend() selector name: _queueForDealloc:
Thread 0:
0 CoreFoundation 0x000000018e384618 CFNumberGetType + 0
1 CoreFoundation 0x000000018e3333b8 _CFAppendXML0 + 2768
2 CoreFoundation 0x000000018e333304 _CFAppendXML0 + 2588
3 CoreFoundation 0x000000018e332268 _CFPropertyListCreateXMLData + 196
4 Foundation 0x000000018ef152f4 -[NSDictionary(NSDictionary) writeToFile:atomically:] + 232
5 SimpleList 0x00000001001ae48c __55-[SharedSettingController writeToContactsReferenceFile]_block_invoke (SharedSettingController.m:620)
6 libdispatch.dylib 0x000000019a974420 _dispatch_call_block_and_release + 20
7 libdispatch.dylib 0x000000019a9743e0 _dispatch_client_callout + 12
8 libdispatch.dylib 0x000000019a97756c _dispatch_main_queue_callback_4CF + 340
9 CoreFoundation 0x000000018e3e6d64 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x000000018e3e50a4 __CFRunLoopRun + 1448
11 CoreFoundation 0x000000018e325b38 CFRunLoopRunSpecific + 448
12 GraphicsServices 0x0000000193d4b830 GSEventRunModal + 164
13 UIKit 0x00000001913640e8 UIApplicationMain + 1152
14 SimpleList 0x000000010006347c _mh_execute_header (main.m:18)
15 libdyld.dylib 0x000000019a98faa0 start + 0
Thread 1:
0 libsystem_kernel.dylib 0x000000019aa71ac8 kevent64 + 8
1 libdispatch.dylib 0x000000019a975d78 _dispatch_mgr_thread + 48
Thread 2 Crashed:
0 libobjc.A.dylib 0x000000019a39f9d0 objc_msgSend + 16
1 CoreData 0x000000018e13b284 -[NSManagedObject release] + 168
2 CoreData 0x000000018e131154 -[_PFArray dealloc] + 96
3 libobjc.A.dylib 0x000000019a3a13d4 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 520
4 libdispatch.dylib 0x000000019a97b428 _dispatch_root_queue_drain + 440
5 libdispatch.dylib 0x000000019a97b638 _dispatch_worker_thread2 + 72
6 libsystem_pthread.dylib 0x000000019ab09918 _pthread_wqthread + 352
7 libsystem_pthread.dylib 0x000000019ab097a8 start_wqthread + 0
Thread 3:
0 libsystem_kernel.dylib 0x000000019aa71cc0 mach_msg_trap + 8
1 CoreFoundation 0x000000018e3e6cac __CFRunLoopServiceMachPort + 180
2 CoreFoundation 0x000000018e3e4e3c __CFRunLoopRun + 832
3 CoreFoundation 0x000000018e325b38 CFRunLoopRunSpecific + 448
4 Foundation 0x000000018ef127fc +[NSURLConnection(Loader) _resourceLoadLoop:] + 344
5 Foundation 0x000000018efa0770 __NSThread__main__ + 996
6 libsystem_pthread.dylib 0x000000019ab0c1b0 _pthread_body + 164
7 libsystem_pthread.dylib 0x000000019ab0c108 _pthread_start + 136
8 libsystem_pthread.dylib 0x000000019ab097b0 thread_start + 0
Thread 4:
0 libsystem_kernel.dylib 0x000000019aa8a76c __select + 8
1 libsystem_pthread.dylib 0x000000019ab0c1b0 _pthread_body + 164
2 libsystem_pthread.dylib 0x000000019ab0c108 _pthread_start + 136
3 libsystem_pthread.dylib 0x000000019ab097b0 thread_start + 0
Thread 5:
0 libsystem_kernel.dylib 0x000000019aa8ae74 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000019ab097a8 start_wqthread + 0
Thread 6:
0 libsystem_kernel.dylib 0x000000019aa8ae74 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000019ab097a8 start_wqthread + 0
Thread 7:
0 libsystem_kernel.dylib 0x000000019aa8ae74 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000019ab097a8 start_wqthread + 0
Thread 2 crashed with ARM-64 Thread State:
pc: 0x000000019a39f9d0 fp: 0x0000000102b479c0 sp: 0x0000000102b479a0 x0: 0x00000001782451f0
x1: 0x000000018e2eeb56 x2: 0x00000001705336a0 x3: 0x000000019aac3d18 x4: 0x0000000000000001
x5: 0x0000000000000010 x6: 0x000000017013f900 x7: 0x0000000000000000 x8: 0x000000019ad5bdb8
x9: 0x000000001c3dbea8 x10: 0x0000000000000000 x11: 0x000000230000003f x12: 0x000000014f073410
x13: 0xbadd5bcc1c3dbead x14: 0xffffffffffffffff x15: 0x0000000000000001 x16: 0x000000019a39f9c0
x17: 0x000000018e13b1d8 x18: 0x0000000000000000 x19: 0x00000001705336a0 x20: 0x000000019ad7b000
x21: 0x000000019adc9200 x22: 0x000000019ad7b000 x23: 0x0000000000000715 x24: 0x0000000000000010
x25: 0x0000000102a64038 x26: 0xa3a3a3a3a3a3a3a3 x27: 0x0000000000000001 x28: 0x0000000000000000
lr: 0x000000018e13b284 cpsr: 0x0000000020000000
At launch, I do initiate a couple of dispatch queues to do some background work (they use a separate MOC to load managed objects and process them), so those might be responsible, but the queues are labelled in my app, and the stack trace doesn't seem to show which queue is responsible (if it is my own queues). I've run the app with NSZombies enabled but that doesn't help. I have also ran the static analysis tool, and that doesn't turn up anything.
Any ideas what might be causing this problem, and what I can do to debug it?
EDIT:
I'm pretty sure I can isolate the problem area down to a piece of code that gets called after launching the app:
SLAppDelegate *delegate = (SLAppDelegate *) [[UIApplication sharedApplication] delegate];
dispatch_async(delegate.coreDataController.filterMainQueue, ^{
NSManagedObjectContext *backgroundContextImage = [[NSManagedObjectContext alloc] init];
[backgroundContextImage setPersistentStoreCoordinator: delegate.coreDataController.persistentStoreCoordinator];
NSArray *items = [Person getAllPersonsWithContext: backgroundContextImage];
// possibly update some of the items
dispatch_async(dispatch_get_main_queue(), ^{
// writes the file inside another dispatch_asyn(dispatch_get_main_queue)
[[SharedSettingController sharedSettings] writeToContactsReferenceFile];
};
});
I'm just not sure what is wrong with this. It works fine 99% of the time. But that 1% is causing a few crashes that I'd love to get resolved.

We hit into a a similar issue when using a private managed object context inside an NSOperation and we ended up working around it by weakifying any parameters and using a private #autoreleasepool. I'll elaborate further below.
Our current set up has an NSOperationQueue which has a long running calculation we do in the background. The operation first creates a private managed object context with the parent set as the main object context and goes and fetches its objects.
In the mean time, we have a separate NSOperationQueue elsewhere that syncs down new data from our server, potentially adding, updating, or removing objects used by our calculation operation.
We first saw a bunch of these crashes out in the wild and the only way to repro it locally is to have both calculation and sync operations run continuously and after 5-10 minutes, we would see a crash similar to one of the below:
Thread : Crashed: background queue :: NSOperation 0x18f43c90
0 libobjc.A.dylib 0x36f11f46 objc_msgSend + 5
1 CoreData 0x2928408f -[NSManagedObject release] + 166
2 CoreData 0x2927b4d7 -[_PFArray dealloc] + 94
3 libobjc.A.dylib 0x36f201a9 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 404
4 CoreFoundation 0x294713a9 _CFAutoreleasePoolPop + 16
5 Foundation 0x2a1b6453 -[__NSOperationInternal _start:] + 1058
6 Foundation 0x2a25b44b __NSOQSchedule_f + 186
7 libdispatch.dylib 0x3746d651 _dispatch_queue_drain + 952
8 libdispatch.dylib 0x3746809d _dispatch_queue_invoke + 84
9 libdispatch.dylib 0x3746eba1 _dispatch_root_queue_drain + 320
10 libdispatch.dylib 0x3746fcd7 _dispatch_worker_thread3 + 94
11 libsystem_pthread.dylib 0x375c6e31 _pthread_wqthread + 668
Thread : Crashed: background queue :: NSOperation 0x1db59e80
0 libsystem_kernel.dylib 0x3722edfc __pthread_kill + 8
1 libsystem_pthread.dylib 0x372acd37 pthread_kill + 62
2 libsystem_c.dylib 0x371ce909 abort + 76
3 libsystem_malloc.dylib 0x37258331 szone_size
4 libobjc.A.dylib 0x36bf1621 object_dispose + 20
5 CoreData 0x28ec571d -[_PFManagedObjectReferenceQueue dealloc] + 80
6 CoreData 0x28e5630f -[NSManagedObject dealloc] + 166
7 CoreData 0x28e55217 -[_PFManagedObjectReferenceQueue _queueForDealloc:] + 246
8 CoreData 0x28e5508f -[NSManagedObject release] + 166
9 CoreData 0x28e4c4d7 -[_PFArray dealloc] + 94
10 libobjc.A.dylib 0x36c031a9 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 404
11 CoreFoundation 0x29042149 _CFAutoreleasePoolPop + 16
12 Foundation 0x29d88c23 -[__NSOperationInternal _start:] + 1058
13 Foundation 0x29e2dc1b __NSOQSchedule_f + 186
14 libdispatch.dylib 0x371505b1 _dispatch_queue_drain + 952
15 libdispatch.dylib 0x3714af85 _dispatch_queue_invoke + 84
16 libdispatch.dylib 0x37151b9b _dispatch_root_queue_drain + 338
17 libdispatch.dylib 0x37152cd7 _dispatch_worker_thread3 + 94
18 libsystem_pthread.dylib 0x372a9e31 _pthread_wqthread + 668
Thread : Crashed: NSOperationQueue Serial Queue
0 libsystem_kernel.dylib 0x396871f0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x396ef7b7 pthread_kill + 58
2 libsystem_c.dylib 0x39637ff9 abort + 76
3 libsystem_malloc.dylib 0x396aed25 szone_size
4 libobjc.A.dylib 0x390d93a9 object_dispose + 20
5 CoreData 0x2e3d4081 -[_PFManagedObjectReferenceQueue dealloc] + 80
6 CoreData 0x2e3655b7 -[NSManagedObject dealloc] + 166
7 CoreData 0x2e364501 -[_PFManagedObjectReferenceQueue _queueForDealloc:] + 244
8 CoreData 0x2e36437d -[NSManagedObject release] + 164
9 CoreData 0x2e35b867 -[_PFArray dealloc] + 94
10 libobjc.A.dylib 0x390e20d3 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 358
11 CoreFoundation 0x2e5294c1 _CFAutoreleasePoolPop + 16
12 Foundation 0x2ef29999 -[__NSOperationInternal _start:] + 1064
13 Foundation 0x2efcd745 __NSOQSchedule_f + 60
14 libdispatch.dylib 0x395c0cbd _dispatch_queue_drain + 488
15 libdispatch.dylib 0x395bdc6f _dispatch_queue_invoke + 42
16 libdispatch.dylib 0x395c15f1 _dispatch_root_queue_drain + 76
17 libdispatch.dylib 0x395c18dd _dispatch_worker_thread2 + 56
18 libsystem_pthread.dylib 0x396ecc17 _pthread_wqthread + 298
We reviewed the code multiple times and was not able to determine why it was crashing. We tried enabling NSZombies, but would run out of memory long before we could get a repro.
What we ended up doing is the following 2 things:
#autoreleasepool
Inside our [privateObjectContext performBlockAndWait:^{…}] which resides inside our NSOperationBlock, we wrapped all the code inside an #autoreleasepool{…}. That way all NSManagedObjects retrieved during that block of code will be mark for release before leaving the performBlockAndWait.
weakify/strongify
Any parameters that include NSManagedObjects were weakify before passing it into the block, and strongify once in the block. This way since we no longer have a strong reference to them, they can be released if they become out of date while we wait for the NSOperation to start. Here's a good article on how weakify/strongify works: http://blog.aceontech.com/post/111694918560/weakifyself-a-more-elegant-solution-to

Related

NO_CRASH_STACK + 0 [Xcode 10.1] Crash

Im experiencing an error in my app affecting almost 80% of my active users.
It seems it has something to do with the thread
`com.twitter.crashlytics.ios.MachExceptionServer`
but I haven't been able to track it down, the worst thing of all is that I don't even know when this crash occurs, my guess is that it happens when the app is launching in the DidFinishLaunchingWithOptions method. :/
Hope you can help me out, I am new to this crash tracking thing.
Here is the crash log.
Incident Identifier: F627A1C2-A28A-4200-8920-1F77D3C0855C
CrashReporter Key: 88dbf413f263228712a90868f4c08e9d59a715f8
Hardware Model: iPhone10,4
Process: <APP_NAME> [1285]
Path: /private/var/containers/Bundle/Application/XXXXXXXXXXXXXXXXX/<APP_NAME>.app/<APP_NAME>
Identifier: xxx.xxxxxxxx.<APP_NAME>
Version: 34 (4.0.0)
AppStoreTools: 10B63
AppVariant: 1:iPhone10,4:12
Code Type: ARM-64 (Native)
Role: Non UI
Parent Process: launchd [1]
Coalition: xxx.xxxxxx.xxxxxx [677]
Date/Time: 2018-12-16 16:41:34.1689 -0600
Launch Time: 2018-12-16 15:52:00.9225 -0600
OS Version: iPhone OS 12.1 (16B92)
Baseband Version: 2.01.07
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000f262e3bc0
VM Region Info: 0xf262e3bc0 is not in any region. Bytes after previous region: 53790784449
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
MALLOC_NANO 0000000280000000-00000002a0000000 [512.0M] rw-/rwx SM=PRV
--->
UNUSED SPACE AT END
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [1285]
Triggered by Thread: 10
Thread 0 name:
Thread 0:
0 libsystem_kernel.dylib 0x0000000203c3bed0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000203c3b3a8 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000020403fbc4 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x000000020403aa60 __CFRunLoopRun + 1396 (CFRunLoop.c:2971)
4 CoreFoundation 0x000000020403a1cc CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 GraphicsServices 0x00000002062b1584 GSEventRunModal + 100 (GSEvent.c:2245)
6 UIKitCore 0x000000023127d054 UIApplicationMain + 212 (UIApplication.m:4347)
7 <APP_NAME> 0x0000000104ae4548 main + 17736 (AppDelegate.swift:22)
8 libdyld.dylib 0x0000000203afabb4 start + 4
Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x0000000203c3bed0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000203c3b3a8 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000020403fbc4 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x000000020403aa60 __CFRunLoopRun + 1396 (CFRunLoop.c:2971)
4 CoreFoundation 0x000000020403a1cc CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 Foundation 0x0000000204a2f404 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300 (NSRunLoop.m:367)
6 Foundation 0x0000000204a2f2b0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 148 (NSRunLoop.m:411)
7 UIKitCore 0x000000023136a808 -[UIEventFetcher threadMain] + 136 (UIEventFetcher.m:603)
8 Foundation 0x0000000204b621ac __NSThread__start__ + 1040 (NSThread.m:1175)
9 libsystem_pthread.dylib 0x0000000203ccb2ac _pthread_body + 128 (pthread.c:857)
10 libsystem_pthread.dylib 0x0000000203ccb20c _pthread_start + 48 (pthread.c:884)
11 libsystem_pthread.dylib 0x0000000203ccecf4 thread_start + 4
Thread 2 name: com.twitter.crashlytics.ios.MachExceptionServer
Thread 2:
0 libsystem_kernel.dylib 0x0000000203c3bed0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000203c3b3a8 mach_msg + 72
2 <APP_NAME> 0x0000000104f0c490 CLSMachExceptionServer + 952
3 libsystem_pthread.dylib 0x0000000203ccb2ac _pthread_body + 128
4 libsystem_pthread.dylib 0x0000000203ccb20c _pthread_start + 48
5 libsystem_pthread.dylib 0x0000000203ccecf4 thread_start + 4
Thread 3 name:
Thread 3:
0 libsystem_kernel.dylib 0x0000000203c3bed0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000203c3b3a8 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000020403fbc4 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x000000020403aa60 __CFRunLoopRun + 1396 (CFRunLoop.c:2971)
4 CoreFoundation 0x000000020403a1cc CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 CFNetwork 0x000000020465b834 -[__CoreSchedulingSetRunnable runForever] + 212 (CoreSchedulingSet.mm:1365)
6 Foundation 0x0000000204b621ac __NSThread__start__ + 1040 (NSThread.m:1175)
7 libsystem_pthread.dylib 0x0000000203ccb2ac _pthread_body + 128 (pthread.c:857)
8 libsystem_pthread.dylib 0x0000000203ccb20c _pthread_start + 48 (pthread.c:884)
9 libsystem_pthread.dylib 0x0000000203ccecf4 thread_start + 4
Thread 4:
0 libsystem_pthread.dylib 0x0000000203ccece8 start_wqthread + 0
Thread 5:
0 libsystem_pthread.dylib 0x0000000203ccece8 start_wqthread + 0
Thread 6:
0 libsystem_pthread.dylib 0x0000000203ccece8 start_wqthread + 0
Thread 7:
0 libsystem_pthread.dylib 0x0000000203ccece8 start_wqthread + 0
Thread 8 name:
Thread 8:
0 libsystem_malloc.dylib 0x0000000203c80c74 nanov2_allocate_from_block$VARIANT$armv81 + 220
1 libsystem_malloc.dylib 0x0000000203c80040 nanov2_allocate$VARIANT$armv81 + 140
2 libsystem_malloc.dylib 0x0000000203c80040 nanov2_allocate$VARIANT$armv81 + 140
3 libsystem_malloc.dylib 0x0000000203c80540 nanov2_calloc$VARIANT$armv81 + 136
4 libsystem_malloc.dylib 0x0000000203c8db74 malloc_zone_calloc + 140 (malloc.c:1475)
5 libsystem_malloc.dylib 0x0000000203c8e3fc calloc + 40 (malloc.c:1731)
6 libobjc.A.dylib 0x0000000203290554 class_createInstance + 72 (objc-runtime-new.mm:0)
7 libdispatch.dylib 0x0000000203ae9ad8 _os_object_alloc_realized + 40 (object.m:55)
8 libdispatch.dylib 0x0000000203ae3af4 dispatch_data_create_concat$VARIANT$armv81 + 164 (data.c:118)
9 CFNetwork 0x00000002048b8ffc invocation function for block in ConnectionProtocolReadInner(nw_protocol*, unsigned int, unsigned int, bool, long long, void (dispatch_data_s*, CFStreamError) block_pointer, void (nw_frame_array_s*, CFStreamError) block_pointer) + 152 (ConnectionProtocol.cpp:771)
10 libnetwork.dylib 0x00000002050d3474 nw_frame_array_foreach + 48 (frame_internal.h:999)
11 CFNetwork 0x00000002048b64ac ConnectionProtocolReadInner(nw_protocol*, unsigned int, unsigned int, bool, long long, void (dispatch_data_s*, CFStreamError) block_pointer, void (nw_frame_array_s*, CFStreamError) block_pointer) + 408 (ConnectionProtocol.cpp:755)
12 CFNetwork 0x00000002048b6264 ConnectionProtocolServiceReads(nw_protocol*) + 380 (ConnectionProtocol.cpp:658)
13 CFNetwork 0x00000002048b7270 ConnectionProtocolInputAvailable(nw_protocol*, nw_protocol*) + 64 (ConnectionProtocol.cpp:964)
14 libboringssl.dylib 0x0000000204f34ac8 nw_boringssl_read + 532 (protocol_boringssl.m:1177)
15 libboringssl.dylib 0x0000000204f362a4 nw_protocol_boringssl_input_available + 120 (protocol_boringssl.m:1218)
16 libusrtcp.dylib 0x00000002053d8e9c nw_protocol_tcp_wake_read + 484 (protocol_tcp.c:269)
17 libusrtcp.dylib 0x00000002053c9774 nw_protocol_tcp_input_flush + 100 (user_north.c:40)
18 libnetwork.dylib 0x0000000205167474 nw_channel_add_input_frames + 4184 (channel.c:1096)
19 libnetwork.dylib 0x00000002051663b8 nw_channel_update_input_source + 136 (channel.c:1138)
20 libnetwork.dylib 0x0000000205165c08 __nw_channel_create_block_invoke.21 + 52 (channel.c:1960)
21 libdispatch.dylib 0x0000000203aea484 _dispatch_client_callout + 16 (object.m:511)
22 libdispatch.dylib 0x0000000203ac0e14 _dispatch_continuation_pop$VARIANT$armv81 + 404 (inline_internal.h:2441)
23 libdispatch.dylib 0x0000000203ad0ab4 _dispatch_source_invoke$VARIANT$armv81 + 1704 (source.c:568)
24 libdispatch.dylib 0x0000000203ac6d70 _dispatch_workloop_invoke$VARIANT$armv81 + 1892 (inline_internal.h:2482)
25 libdispatch.dylib 0x0000000203acdf14 _dispatch_workloop_worker_thread + 584 (queue.c:5889)
26 libsystem_pthread.dylib 0x0000000203ccc0dc _pthread_wqthread + 312 (pthread.c:2363)
27 libsystem_pthread.dylib 0x0000000203ccecec start_wqthread + 4
Thread 9:
0 libsystem_pthread.dylib 0x0000000203ccece8 start_wqthread + 0
Thread 10 name:
Thread 10 Crashed:
0 libobjc.A.dylib 0x0000000203298d70 objc_msgSend + 16
1 CoreData 0x0000000206c17754 -[_PFArray dealloc] + 100 (_PFArray.m:379)
2 libobjc.A.dylib 0x000000020329b38c (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 676 (NSObject.mm:1605)
3 libdispatch.dylib 0x0000000203aea464 _dispatch_last_resort_autorelease_pool_pop + 40 (object.m:488)
4 libdispatch.dylib 0x0000000203accddc _dispatch_root_queue_drain + 1080 (queue.c:6049)
5 libdispatch.dylib 0x0000000203acd35c _dispatch_worker_thread2 + 116 (queue.c:6072)
6 libsystem_pthread.dylib 0x0000000203ccc17c _pthread_wqthread + 472 (pthread.c:2353)
7 libsystem_pthread.dylib 0x0000000203ccecec start_wqthread + 4
Thread 11:
0 libsystem_pthread.dylib 0x0000000203ccece8 start_wqthread + 0
Thread 10 crashed with ARM Thread State (64-bit):
x0: 0x0000000280283bb0 x1: 0x00000002317c19b4 x2: 0x0000000000000001 x3: 0x0000000203c8019c
x4: 0x000000014a514400 x5: 0x0000000000000012 x6: 0x000000023b9c4000 x7: 0x000000016b77e538
x8: 0x0000000281685080 x9: 0x0000000000000000 x10: 0x0000000148860a00 x11: 0x0000002f0000003f
x12: 0x0000000148860d40 x13: 0x0000a69f262e3bb0 x14: 0x000000000000004c x15: 0x0000000080000000
x16: 0x0000000f262e3bb0 x17: 0x0000000206c0f138 x18: 0x0000000000000000 x19: 0x0000000282fc8b70
x20: 0x00000002317c19b4 x21: 0x000000000000000c x22: 0x0000000000000020 x23: 0x0000000000000015
x24: 0x0000000000000010 x25: 0x0000000000000000 x26: 0x0000000000000000 x27: 0x0000000000000000
x28: 0x000000016b77f0e0 fp: 0x000000016b77ea80 lr: 0x0000000206c17754
sp: 0x000000016b77ea40 pc: 0x0000000203298d70 cpsr: 0x20000000
AppDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
GeoBasedManager.instance.setCountry()
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
NotificationManager.shared.retrievePushNotifications()
FirebaseApp.configure()
SwiftDate.defaultRegion = Region.local
DropDown.startListeningToKeyboard()
return true
The thread com.twitter.crashlytics.ios.MachExceptionServer is a part of the Crashlytics reporting machinery. It is present in every report that Crashlytics generates, and is not related to your issue.
From your report, that Triggered by Thread: 10 indicates which thread is at fault. From that, we can see that you've got what looks like a classic over-release.
Thread 10 name:
Thread 10 Crashed:
0 libobjc.A.dylib 0x0000000203298d70 objc_msgSend + 16
1 CoreData 0x0000000206c17754 -[_PFArray dealloc] + 100 (_PFArray.m:379)
2 libobjc.A.dylib 0x000000020329b38c (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 676 (NSObject.mm:1605)
3 libdispatch.dylib 0x0000000203aea464 _dispatch_last_resort_autorelease_pool_pop + 40 (object.m:488)
4 libdispatch.dylib 0x0000000203accddc _dispatch_root_queue_drain + 1080 (queue.c:6049)
5 libdispatch.dylib 0x0000000203acd35c _dispatch_worker_thread2 + 116 (queue.c:6072)
6 libsystem_pthread.dylib 0x0000000203ccc17c _pthread_wqthread + 472 (pthread.c:2353)
7 libsystem_pthread.dylib 0x0000000203ccecec start_wqthread + 4
From frame 2 and 3, you can see that the system is cleaning up auto-released objects, from what looks like an internal dispatch queue. In there is an object that has already been deallocated, but is now being released again.
This kinds of bugs can manifest themselves in a variety of different-looking crashes. They can be hard to debug. As you are seeing, it is very hard to determine where the actual over-release occurred. Fortunately, Apple provides a few tools that can help. Check out the Zombies feature of Instruments. Good luck!

Can't determine cause from this crash log

I had an app in the App Store with lots of crashes, but I can't reproduce it myself.
I have lots of crash logs but they don't contain a backtrace making it difficult to diagnose the issue.
The crash logs show CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER which possibly could be caused by a notification being sent to a deallocated observer according to other questions on SO.
However the app only runs on iOS 10+, and according to Apple its not necessary to de-register observers from iOS 9 onwards unless they are block observers. Which my app doesn't use so that can't be the cause as far as my own apps notifications are concerned.
Incident Identifier: 77AB1312-9C1F-4BC1-957E-B742856DC635
CrashReporter Key: 6ad59ac64c53d2fc92208e8df23d4ddc8fed39fd
Hardware Model: iPhone10,3
Process: My App [378]
Path: /private/var/containers/Bundle/Application/99C2E2C8-9655-4D07-9608-870B5DD17C21/My app.app/My app
Identifier: com.myapp
OS Version: iPhone OS 10.3.2 (14F89)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.myapp[498]
Date/Time: 2018-06-06 00:18:34.2085 -0700
Launch Time: 2018-06-06 00:17:39.1406 -0700
Baseband Version: 2.03.00
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018ec4d014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018ed17264 pthread_kill + 112 (pthread.c:1366)
2 libsystem_c.dylib 0x000000018ebc19c4 abort + 140 (abort.c:91)
3 libswiftCore.dylib 0x0000000100ad976c 0x1007ec000 + 3069804
4 libswiftCore.dylib 0x0000000100b0614c 0x1007ec000 + 3252556
5 CoreFoundation 0x000000018fc56f54 ___forwarding___ + 916 (NSForwarding.m:3126)
6 CoreFoundation 0x000000018fb52d4c _CF_forwarding_prep_0 + 92
7 CoreFoundation 0x000000018fbed5f4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20 (CFNotificationCenter.c:650)
8 CoreFoundation 0x000000018fbecd08 _CFXRegistrationPost + 400 (CFNotificationCenter.c:164)
9 CoreFoundation 0x000000018fbeca84 ___CFXNotificationPost_block_invoke + 60 (CFNotificationCenter.c:1031)
10 CoreFoundation 0x000000018fc5b7a8 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1412 (CFXNotificationRegistrar.m:163)
11 CoreFoundation 0x000000018fb3095c _CFXNotificationPost + 376 (CFNotificationCenter.c:1028)
12 Foundation 0x0000000190642930 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68 (NSNotification.m:482)
13 UIKit 0x0000000195e07ea8 -[UIApplication _stopDeactivatingForReason:] + 1124 (UIApplication.m:1534)
14 UIKit 0x0000000196005b4c __62-[UIApplication _sceneSettingsPostLifecycleEventDiffInspector]_block_invoke.1259 + 124 (UIApplication.m:3247)
15 FrontBoardServices 0x00000001917e4be8 __52-[FBSSettingsDiffInspector inspectDiff:withContext:]_block_invoke.27 + 204 (FBSSettingsDiffInspector.m:46)
16 Foundation 0x00000001906fc7fc __NSIndexSetEnumerate + 724 (NSIndexSet.m:1347)
17 BaseBoard 0x0000000191757510 -[BSSettingsDiff inspectChangesWithBlock:] + 104 (BSSettingsDiff.m:187)
18 FrontBoardServices 0x00000001917dece4 -[FBSSettingsDiff inspectOtherChangesWithBlock:] + 88 (FBSSettingsDiff.m:65)
19 FrontBoardServices 0x00000001917e49bc -[FBSSettingsDiffInspector inspectDiff:withContext:] + 280 (FBSSettingsDiffInspector.m:44)
20 UIKit 0x00000001960064d4 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 196 (UIApplication.m:3346)
21 UIKit 0x0000000196006124 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 892 (UIApplication.m:3357)
22 UIKit 0x00000001963407c8 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 464 (UIApplicationSceneClientAgent.m:74)
23 FrontBoardServices 0x00000001917ce22c __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.376 + 208 (FBSSceneImpl.m:598)
24 FrontBoardServices 0x00000001917fb884 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 (FBSSerialQueue.m:158)
25 FrontBoardServices 0x00000001917fb6f0 -[FBSSerialQueue _performNext] + 176 (FBSSerialQueue.m:177)
26 FrontBoardServices 0x00000001917fbaa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 (FBSSerialQueue.m:206)
27 CoreFoundation 0x000000018fc0142c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1943)
28 CoreFoundation 0x000000018fc00d9c __CFRunLoopDoSources0 + 540 (CFRunLoop.c:1989)
29 CoreFoundation 0x000000018fbfe9a8 __CFRunLoopRun + 744 (CFRunLoop.c:2821)
30 CoreFoundation 0x000000018fb2eda4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
31 GraphicsServices 0x0000000191598074 GSEventRunModal + 100 (GSEvent.c:2245)
32 UIKit 0x0000000195de9058 UIApplicationMain + 208 (UIApplication.m:4089)
33 My App 0x00000001000be2e4 main + 56 (MyFile.swift:17)
34 libdyld.dylib 0x000000018eb3d59c start + 4
hread 1:
0 libsystem_pthread.dylib 0x0000000220f92064 start_wqthread + 0
Thread 2 name:
Thread 2:
0 libsystem_kernel.dylib 0x0000000220ef6ac8 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000220ef6940 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000022131d2f0 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x000000022131af80 __CFRunLoopRun + 1404 (CFRunLoop.c:2971)
4 CoreFoundation 0x0000000221254abc CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 Foundation 0x0000000221cd0544 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300 (NSRunLoop.m:367)
6 Foundation 0x0000000221cd03f0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 148 (NSRunLoop.m:411)
7 UIKitCore 0x000000024c433a7c -[UIEventFetcher threadMain] + 136 (UIEventFetcher.m:524)
8 Foundation 0x0000000221de0a94 __NSThread__start__ + 1040 (NSThread.m:1175)
9 libsystem_pthread.dylib 0x0000000220f931e4 _pthread_body + 128 (pthread.c:804)
10 libsystem_pthread.dylib 0x0000000220f93164 _pthread_start + 40 (pthread.c:827)
11 libsystem_pthread.dylib 0x0000000220f92070 thread_start + 4
Thread 3 name:
Thread 3:
0 libsystem_kernel.dylib 0x0000000220ef6ac8 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000220ef6940 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000022131d2f0 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x000000022131af80 __CFRunLoopRun + 1404 (CFRunLoop.c:2971)
4 CoreFoundation 0x0000000221254abc CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 CFNetwork 0x0000000221b5fc8c -[__CoreSchedulingSetRunnable runForever] + 212 (CoreSchedulingSet.mm:1365)
6 Foundation 0x0000000221de0a94 __NSThread__start__ + 1040 (NSThread.m:1175)
7 libsystem_pthread.dylib 0x0000000220f931e4 _pthread_body + 128 (pthread.c:804)
8 libsystem_pthread.dylib 0x0000000220f93164 _pthread_start + 40 (pthread.c:827)
9 libsystem_pthread.dylib 0x0000000220f92070 thread_start + 4
Thread 4 name:
Thread 4:
0 libsystem_kernel.dylib 0x0000000220f184ac __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x0000000220f9a638 _pthread_cond_wait$VARIANT$armv81 + 620 (pthread_cond.c:578)
2 libc++.1.dylib 0x00000002205b2e28 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24 (__threading_support:278)
3 JavaScriptCore 0x0000000228f44524 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 104 (condition_variable:204)
4 JavaScriptCore 0x0000000228f48300 bmalloc::Scavenger::threadRunLoop() + 172 (condition_variable:213)
5 JavaScriptCore 0x0000000228f47ac4 bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 12 (Scavenger.cpp:352)
6 JavaScriptCore 0x0000000228f494b8 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::Scavenger*), bmalloc::Scavenger*> >(void*) + 44 (type_traits:4428)
7 libsystem_pthread.dylib 0x0000000220f931e4 _pthread_body + 128 (pthread.c:804)
8 libsystem_pthread.dylib 0x0000000220f93164 _pthread_start + 40 (pthread.c:827)
9 libsystem_pthread.dylib 0x0000000220f92070 thread_start + 4
Thread 5 name:
Thread 5:
0 libsystem_kernel.dylib 0x0000000220efb088 kevent + 8
1 Realm 0x00000001025f112c realm::_impl::ExternalCommitHelper::listen() + 212 (external_commit_helper.cpp:202)
2 Realm 0x00000001025f1d20 std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0>::operator()() + 28 (external_commit_helper.cpp:159)
3 Realm 0x00000001025f1ca8 std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >::__execute() + 28 (future:1039)
4 Realm 0x00000001025f1e58 std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >::*)(), std::__1::__async_assoc_state<void, std::__1::__async_func<realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >*> >(void*, void*) + 64 (type_traits:4232)
5 libsystem_pthread.dylib 0x0000000220f931e4 _pthread_body + 128 (pthread.c:804)
6 libsystem_pthread.dylib 0x0000000220f93164 _pthread_start + 40 (pthread.c:827)
7 libsystem_pthread.dylib 0x0000000220f92070 thread_start + 4
Thread 6 name:
Thread 6:
0 libsystem_kernel.dylib 0x0000000220ef6ac8 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000220ef6940 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x000000022131d2f0 __CFRunLoopServiceMachPort + 236 (CFRunLoop.c:2615)
3 CoreFoundation 0x000000022131af80 __CFRunLoopRun + 1404 (CFRunLoop.c:2971)
4 CoreFoundation 0x0000000221254abc CFRunLoopRunSpecific + 436 (CFRunLoop.c:3247)
5 AVFAudio 0x0000000227a31cd0 GenericRunLoopThread::Entry(void*) + 164 (GenericRunLoopThread.h:92)
6 AVFAudio 0x0000000227a5ce94 CAPThread::Entry(CAPThread*) + 88
7 libsystem_pthread.dylib 0x0000000220f931e4 _pthread_body + 128 (pthread.c:804)
8 libsystem_pthread.dylib 0x0000000220f93164 _pthread_start + 40 (pthread.c:827)
9 libsystem_pthread.dylib 0x0000000220f92070 thread_start + 4
Thread 7:
0 libsystem_pthread.dylib 0x0000000220f92064 start_wqthread + 0
Thread 8:
0 libsystem_pthread.dylib 0x0000000220f92064 start_wqthread + 0
Thread 9:
0 libsystem_pthread.dylib 0x0000000220f92064 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000282a1a766
x4: 0x0000000103938280 x5: 0x0000000000000020 x6: 0x0046000004210103 x7: 0x00000000ffba0038
x8: 0x0000000000000800 x9: 0x0000000220f98b44 x10: 0x0000000220f9408c x11: 0x000000025b529562
x12: 0x000000025b529562 x13: 0x0000000000000018 x14: 0x0000000000000001 x15: 0x0000000000000881
x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x0000000259099100 x21: 0x000000000000002d x22: 0x0000000000000303 x23: 0x00000002590991e0
x24: 0x0000000000000000 x25: 0x000000024d2a3912 x26: 0x0000000102eec200 x27: 0x000000025909cf10
x28: 0x0000000000000001 fp: 0x000000016ddd9960 lr: 0x0000000220f98c70
sp: 0x000000016ddd9930 pc: 0x0000000220f186a4 cpsr: 0x00000000
FYI Line 17 of MyFile.swift is just this:
#objc class RealmDatabase : NSObject
{
var configuration:Realm.Configuration? = nil // Line 17
Thats just a declaration of an optional, so I don't see how that could cause any problems.
Are there any other clues as to what the problem could be?
Just a wild stab in the dark:
One reason that this error can happen is due to ARC and weak references.
A common pattern in iOS is the delegate pattern, where a separate object is constructed to handle the messages of another object. These references are often weak, so that you don't get a memory cycle, where two objects own a strong reference to each other.
Now, it could be, somewhere in your code, that you are generating a RealmDatabase instance somewhere, and handing it off to another object as a weak reference. If this is the case, then it will be destroyed by ARC as soon as all the strong references to it are gone: for example, if it is being referenced by a Realm connection instance of some sort, and the connection is dropped.
This is just a wild guess, but if you are dynamically creating RealmDatabase instances when certain events happen, store references to those objects in a stored property on some object, as an optional, to keep them from being destroyed by ARC.
Good luck, and I hope you solve this for your users.

Interpretation of iOS crash log with -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:]

My submission to the App Store was rejected due to a crash. However, I am unable to reproduce the crash on multiple hardware devices and simulators. I've symbolicated the crash log, and it seems the issue is occurring in an area of code where the app is fetching some data from a server and closing a UIAlertController that notifies the user to "Please wait..." Below is the crash log.
Date/Time: 2017-05-06 00:27:06.7009 +0700
Launch Time: 2017-05-06 00:26:43.8793 +0700
OS Version: iPhone OS 10.3.1 (14E304)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 1
Application Specific Information:
abort() called
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x18c47efd8 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x18aee0538 objc_exception_throw + 56
2 CoreFoundation 0x18c47eeac +[NSException raise:format:arguments:] + 104
3 Foundation 0x18cf16710 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
4 UIKit 0x192823454 -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:] + 196
5 UIKit 0x192823514 -[UIApplication _systemAnimationFenceCreatingIfNecessary:] + 24
6 UIKit 0x19287c7a0 +[UIWindow _synchronizedDrawingFence] + 116
7 UIKit 0x192a3a150 +[_UIKeyboardChangedInformation informationForKeyboardUp:withIAV:] + 104
8 UIKit 0x192d338d4 -[_UIRemoteKeyboards prepareToMoveKeyboard:withIAV:showing:forScreen:] + 464
9 UIKit 0x19266bc04 -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 820
10 UIKit 0x192688cf4 -[UIPeripheralHost(UIKitInternal) _restoreInputViewsWithId:animated:] + 584
11 UIKit 0x19291bd64 -[UIViewController _restoreInputViewsForPresentation] + 280
12 UIKit 0x1928f6e3c -[UIPresentationController runTransitionForCurrentState] + 1560
13 UIKit 0x1928f50f8 -[UIPresentationController _dismissWithAnimationController:interactionController:target:didEndSelector:] + 764
14 UIKit 0x19291b8c0 -[UIViewController _dismissViewControllerWithAnimationController:interactionController:completion:] + 464
15 UIKit 0x1926d0cd4 -[UIViewController _dismissViewControllerWithTransition:from:completion:] + 600
16 UIKit 0x192678b6c -[UIViewController dismissViewControllerWithTransition:completion:] + 1144
17 UIKit 0x19267894c -[UIViewController dismissViewControllerWithTransition:completion:] + 600
18 UIKit 0x19291ab68 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 524
19 UIKit 0x1926786c0 -[UIViewController dismissViewControllerAnimated:completion:] + 152
20 DinokEtp 0x1001014c4 specialized ViewController.(downloadCaseTypesFile(workFlowVersionMobileShouleBeOn : Double, validateUserResponse : ValidateUserResponse) -> ()).(closure #1) (ViewController.swift:360)
21 DinokEtp 0x1000fd84c ViewController.(downloadCaseTypesFile(workFlowVersionMobileShouleBeOn : Double, validateUserResponse : ValidateUserResponse) -> ()).(closure #1) (ViewController.swift:0)
22 DinokEtp 0x100101b38 partial apply for ViewController.(downloadCaseTypesFile(workFlowVersionMobileShouleBeOn : Double, validateUserResponse : ValidateUserResponse) -> ()).(closure #1) (ViewController.swift:0)
23 CFNetwork 0x18ca89358 __85-[__NSURLSessionLocal downloadTaskForRequest:downloadFilePath:resumeData:completion:]_block_invoke + 32
24 CFNetwork 0x18caeb18c __50-[__NSCFLocalDownloadTask _private_fileCompletion]_block_invoke.321 + 84
25 Foundation 0x18cf4d804 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
26 Foundation 0x18ce92760 -[NSBlockOperation main] + 96
27 Foundation 0x18ce82b18 -[__NSOperationInternal _start:] + 612
28 Foundation 0x18cf4fba0 __NSOQSchedule_f + 228
29 libdispatch.dylib 0x18b3369a0 _dispatch_client_callout + 16
30 libdispatch.dylib 0x18b344ad4 _dispatch_queue_serial_drain + 928
31 libdispatch.dylib 0x18b33a2cc _dispatch_queue_invoke + 884
32 libdispatch.dylib 0x18b346a50 _dispatch_root_queue_drain + 540
33 libdispatch.dylib 0x18b3467d0 _dispatch_worker_thread3 + 124
34 libsystem_pthread.dylib 0x18b53f1d0 _pthread_wqthread + 1096
35 libsystem_pthread.dylib 0x18b53ed7c start_wqthread + 4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x000000018b45b224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018b45b09c mach_msg + 72
2 CoreFoundation 0x000000018c42ce88 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018c42aadc __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018c35ad94 CFRunLoopRunSpecific + 424
5 GraphicsServices 0x000000018ddc4074 GSEventRunModal + 100
6 UIKit 0x000000019260c130 UIApplicationMain + 208
7 DinokEtp 0x00000001000654bc main (EMSCaseUpload.swift:14)
8 libdyld.dylib 0x000000018b36959c start + 4
Thread 1 name: Dispatch queue: NSOperationQueue 0x17003e2c0 :: NSOperation 0x17025e5d0 (QOS: DEFAULT)
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x000000018b479014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018b543334 pthread_kill + 112
2 libsystem_c.dylib 0x000000018b3ed9c4 abort + 140
3 libc++abi.dylib 0x000000018aeb91b0 __cxa_bad_cast + 0
4 libc++abi.dylib 0x000000018aed2c04 default_unexpected_handler() + 0
5 libobjc.A.dylib 0x000000018aee0820 _objc_terminate() + 124
6 libc++abi.dylib 0x000000018aecf5d4 std::__terminate(void (*)()) + 16
7 libc++abi.dylib 0x000000018aecf640 std::terminate() + 60
8 libdispatch.dylib 0x000000018b3369b4 _dispatch_client_callout + 36
9 libdispatch.dylib 0x000000018b344ad4 _dispatch_queue_serial_drain + 928
10 libdispatch.dylib 0x000000018b33a2cc _dispatch_queue_invoke + 884
11 libdispatch.dylib 0x000000018b346a50 _dispatch_root_queue_drain + 540
12 libdispatch.dylib 0x000000018b3467d0 _dispatch_worker_thread3 + 124
13 libsystem_pthread.dylib 0x000000018b53f1d0 _pthread_wqthread + 1096
14 libsystem_pthread.dylib 0x000000018b53ed7c start_wqthread + 4
Thread 2:
0 libsystem_pthread.dylib 0x000000018b53ed78 start_wqthread + 0
Thread 3 name: com.apple.uikit.eventfetch-thread
Thread 3:
0 libsystem_kernel.dylib 0x000000018b45b224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018b45b09c mach_msg + 72
2 CoreFoundation 0x000000018c42ce88 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018c42aadc __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018c35ad94 CFRunLoopRunSpecific + 424
5 Foundation 0x000000018ce74d64 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x000000018ce95b34 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7 UIKit 0x0000000192f965f8 -[UIEventFetcher threadMain] + 136
8 Foundation 0x000000018cf722c8 __NSThread__start__ + 996
9 libsystem_pthread.dylib 0x000000018b54175c _pthread_body + 240
10 libsystem_pthread.dylib 0x000000018b54166c _pthread_body + 0
11 libsystem_pthread.dylib 0x000000018b53ed84 thread_start + 4
Thread 4:
0 libsystem_kernel.dylib 0x000000018b479a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000018b53f274 _pthread_wqthread + 1260
2 libsystem_pthread.dylib 0x000000018b53ed7c start_wqthread + 4
Thread 5:
0 libsystem_pthread.dylib 0x000000018b53ed78 start_wqthread + 0
Thread 6 name: com.apple.NSURLConnectionLoader
Thread 6:
0 libsystem_kernel.dylib 0x000000018b45b224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018b45b09c mach_msg + 72
2 CoreFoundation 0x000000018c42ce88 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018c42aadc __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018c35ad94 CFRunLoopRunSpecific + 424
5 CFNetwork 0x000000018cb66ca4 +[NSURLConnection(Loader) _resourceLoadLoop:] + 404
6 Foundation 0x000000018cf722c8 __NSThread__start__ + 996
7 libsystem_pthread.dylib 0x000000018b54175c _pthread_body + 240
8 libsystem_pthread.dylib 0x000000018b54166c _pthread_body + 0
9 libsystem_pthread.dylib 0x000000018b53ed84 thread_start + 4
Thread 1 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x00000001700f8c37
x4: 0x000000018aed3b07 x5: 0x000000016de9a850 x6: 0x000000000000006e x7: 0xffffffffffffffec
x8: 0x000000000c000000 x9: 0x0000000004000000 x10: 0x000000000000000b x11: 0x000000000000000b
x12: 0x0000000000000010 x13: 0x000000018c6c9c0e x14: 0x0000030000000300 x15: 0x0000000000000000
x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x000000016de9b000 x21: 0x000000016de9a850 x22: 0x00000001700ff380 x23: 0x0000000000000004
x24: 0x00000001b1ebd400 x25: 0x0000000000000000 x26: 0x00000001b1ebd400 x27: 0x000000016de9b0e0
x28: 0x0000000000000000 fp: 0x000000016de9a7b0 lr: 0x000000018b543334
sp: 0x000000016de9a790 pc: 0x000000018b479014 cpsr: 0x00000000
I would recommend double checking that you are not interacting with that UIAlertController (or any other UIKit API) outside the main thread (aka, Thread 0 above). Many UIKit APIs are designed to be used only from the main thread.
Worth noting that the crash happened on Thread 1…
If you are in doubt, wrap the call with:
DispatchQueue.main.async {
// Call UIAlertController code here...
}

Crash EXC_CRASH (SIGABRT) on iOS 8.4

I have a crash that only occurs on Apple review: when they try to login the app crashes.
I tested it with real iPhones in test environment and in Ad-hoc several times and the crash never occurred before.
After the review I made some research and I found some similar things and I have been trying out but I can't event simulate the same issue here (I also tried to change Xcode debug to release and he crash does not happen).
Here is what they said it happened at the review:
Upon further review and a fresh install of your app we continue to
find that your app crashed on an iPad running iOS 8.4 and iPhone
running iOS 8.4 when we:
1. Launch App
2. Input provided demo account credentials
3. Tap "Login"
4. Application crashes.
Here is the symbolicated log:
Last Exception Backtrace:
0 CoreFoundation 0x1820ac2d8 __exceptionPreprocess + 132
1 libobjc.A.dylib 0x193c7c0e4 objc_exception_throw + 60
2 CoreFoundation 0x1820ac198 +[NSException raise:format:arguments:] + 116
3 Foundation 0x182f60ed4 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
4 UIKit 0x186b4f1e0 -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 184
5 UIKit 0x186b4f8c8 -[UIKeyboardImpl setDelegate:force:] + 636
6 UIKit 0x186b48b3c -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1212
7 UIKit 0x186c2709c -[UIResponder _finishResignFirstResponder] + 184
8 UIKit 0x187277730 -[UITextField _finishResignFirstResponder] + 56
9 UIKit 0x186bced5c -[UIResponder resignFirstResponder] + 320
10 UIKit 0x186c508bc -[UITextField resignFirstResponder] + 124
11 UIKit 0x186d4b170 -[UITextField _setEnabled:animated:] + 128
12 PioNET 0x100051110 -[LoginViewController startLogging] (LoginViewController.m:667)
13 Foundation 0x182faddb8 __NSThread__main__ + 1072
14 libsystem_pthread.dylib 0x1944dbdc8 _pthread_body + 164
15 libsystem_pthread.dylib 0x1944dbd24 _pthread_start + 160
16 libsystem_pthread.dylib 0x1944d8ef8 thread_start + 4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 PioNET 0x00000001000e3274 +[AFNetworkReachabilityManager sharedManager] (AFNetworkReachabilityManager.m:113)
1 PioNET 0x00000001000dee9c +[AFHTTPRequestOperationManager manager] (AFHTTPRequestOperationManager.m:41)
2 PioNET 0x000000010004db98 -[LoginViewController authentication:andPassword:] (LoginViewController.m:247)
3 PioNET 0x0000000100050cfc -[LoginViewController loginProcess:andPassword:] (LoginViewController.m:641)
4 PioNET 0x00000001000514b4 -[LoginViewController login:] (LoginViewController.m:692)
5 UIKit 0x0000000186b59394 -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x0000000186b42470 -[UIControl _sendActionsForEvents:withEvent:] + 608
7 UIKit 0x0000000186b58d30 -[UIControl touchesEnded:withEvent:] + 588
8 UIKit 0x0000000186b589bc -[UIWindow _sendTouchesForEvent:] + 696
9 UIKit 0x0000000186b51ef8 -[UIWindow sendEvent:] + 680
10 UIKit 0x0000000186b2511c -[UIApplication sendEvent:] + 260
11 UIKit 0x0000000186dc62b4 _UIApplicationHandleEventFromQueueEvent + 15420
12 UIKit 0x0000000186b23630 _UIApplicationHandleEventQueue + 1712
13 CoreFoundation 0x000000018206423c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20
14 CoreFoundation 0x00000001820634e0 __CFRunLoopDoSources0 + 260
15 CoreFoundation 0x0000000182061590 __CFRunLoopRun + 708
16 CoreFoundation 0x0000000181f8d2d0 CFRunLoopRunSpecific + 392
17 GraphicsServices 0x000000018b8bb6f8 GSEventRunModal + 164
18 UIKit 0x0000000186b8af3c UIApplicationMain + 1484
19 PioNET 0x00000001000709b0 main (main.m:14)
20 libdyld.dylib 0x0000000194326a04 start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x0000000194424c24 kevent64 + 8
1 libdispatch.dylib 0x0000000194309e6c _dispatch_mgr_invoke + 272
2 libdispatch.dylib 0x00000001942fb998 _dispatch_mgr_thread + 48
Thread 2:
0 libsystem_kernel.dylib 0x000000019443fc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001944d92d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001944d8eec start_wqthread + 0
Thread 3:
0 libsystem_kernel.dylib 0x000000019443fc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001944d92d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001944d8eec start_wqthread + 0
Thread 4:
0 libsystem_kernel.dylib 0x000000019443fc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001944d92d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001944d8eec start_wqthread + 0
Thread 5:
0 libsystem_kernel.dylib 0x000000019443fc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001944d92d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001944d8eec start_wqthread + 0
Thread 6:
0 libsystem_kernel.dylib 0x000000019443fc78 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x00000001944d92d8 _pthread_wqthread + 988
2 libsystem_pthread.dylib 0x00000001944d8eec start_wqthread + 0
Thread 7 name: com.apple.NSURLConnectionLoader
Thread 7:
0 libsystem_kernel.dylib 0x0000000194424e0c mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000194424c84 mach_msg + 68
2 CoreFoundation 0x0000000182063720 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000182061674 __CFRunLoopRun + 936
4 CoreFoundation 0x0000000181f8d2d0 CFRunLoopRunSpecific + 392
5 CFNetwork 0x0000000181a6a590 +[NSURLConnection(Loader) _resourceLoadLoop:] + 436
6 Foundation 0x0000000182faddb4 __NSThread__main__ + 1068
7 libsystem_pthread.dylib 0x00000001944dbdc4 _pthread_body + 160
8 libsystem_pthread.dylib 0x00000001944dbd20 _pthread_start + 156
9 libsystem_pthread.dylib 0x00000001944d8ef4 thread_start + 0
Thread 8 name: com.apple.CFSocket.private
Thread 8:
0 libsystem_kernel.dylib 0x000000019443f498 __select + 8
1 CoreFoundation 0x0000000182069124 __CFSocketManager + 668
2 libsystem_pthread.dylib 0x00000001944dbdc4 _pthread_body + 160
3 libsystem_pthread.dylib 0x00000001944dbd20 _pthread_start + 156
4 libsystem_pthread.dylib 0x00000001944d8ef4 thread_start + 0
Thread 9:
0 libsystem_kernel.dylib 0x0000000194424e0c mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000194424c84 mach_msg + 68
2 CoreFoundation 0x0000000182063720 __CFRunLoopServiceMachPort + 196
3 CoreFoundation 0x0000000182061674 __CFRunLoopRun + 936
4 CoreFoundation 0x0000000181f8d2d0 CFRunLoopRunSpecific + 392
5 CoreFoundation 0x0000000181fdf358 CFRunLoopRun + 108
6 CoreMotion 0x00000001829982b8 0x182950000 + 295608
7 libsystem_pthread.dylib 0x00000001944dbdc4 _pthread_body + 160
8 libsystem_pthread.dylib 0x00000001944dbd20 _pthread_start + 156
9 libsystem_pthread.dylib 0x00000001944d8ef4 thread_start + 0
Thread 10 Crashed:
0 libsystem_kernel.dylib 0x000000019443f270 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001944dd16c pthread_kill + 108
2 libsystem_c.dylib 0x00000001943b6b14 abort + 108
3 libc++abi.dylib 0x0000000193449414 abort_message + 112
4 libc++abi.dylib 0x0000000193468b88 default_terminate_handler() + 300
5 libobjc.A.dylib 0x0000000193c7c3bc _objc_terminate() + 124
6 libc++abi.dylib 0x0000000193465bb0 std::__terminate(void (*)()) + 12
7 libc++abi.dylib 0x0000000193465474 __cxa_throw + 132
8 libobjc.A.dylib 0x0000000193c7c200 objc_exception_throw + 344
9 CoreFoundation 0x00000001820ac194 +[NSException raise:format:arguments:] + 112
10 Foundation 0x0000000182f60ed0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 108
11 UIKit 0x0000000186b4f1dc -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 180
12 UIKit 0x0000000186b4f8c4 -[UIKeyboardImpl setDelegate:force:] + 632
13 UIKit 0x0000000186b48b38 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1208
14 UIKit 0x0000000186c27098 -[UIResponder _finishResignFirstResponder] + 180
15 UIKit 0x000000018727772c -[UITextField _finishResignFirstResponder] + 52
16 UIKit 0x0000000186bced58 -[UIResponder resignFirstResponder] + 316
17 UIKit 0x0000000186c508b8 -[UITextField resignFirstResponder] + 120
18 UIKit 0x0000000186d4b16c -[UITextField _setEnabled:animated:] + 124
19 PioNET 0x000000010005110c -[LoginViewController startLogging] (LoginViewController.m:667)
20 Foundation 0x0000000182faddb4 __NSThread__main__ + 1068
21 libsystem_pthread.dylib 0x00000001944dbdc4 _pthread_body + 160
22 libsystem_pthread.dylib 0x00000001944dbd20 _pthread_start + 156
23 libsystem_pthread.dylib 0x00000001944d8ef4 thread_start + 0
Thread 10 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x00000001700ed0b7
x4: 0x0000000193469dfd x5: 0x0000000105476460 x6: 0x000000000000006e x7: 0x0000000000000fa0
x8: 0x0000000008000000 x9: 0x0000000004000000 x10: 0x0000000000000200 x11: 0x0000000000000000
x12: 0x0000000000000000 x13: 0x0000000000000000 x14: 0x0000000000000002 x15: 0x0000000000000000
x16: 0x0000000000000148 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x0000000105478000 x21: 0x00000001983f1ce8 x22: 0x0000000170010360 x23: 0x0000000000000000
x24: 0x0000000000000000 x25: 0x0000000000000000 x26: 0x0000000187316681 x27: 0x0000000194c08000
x28: 0x0000000000000110 fp: 0x00000001054763c0 lr: 0x00000001944dd170
sp: 0x00000001054763a0 pc: 0x000000019443f270 cpsr: 0x00000000
Do you use some third party control? It's not rare some controls crash when compiled for release.
You can try to turn off the code optimizations for the release build and test if it crashes.
Looks like it crashed at
0 PioNET 0x00000001000e3274 +[AFNetworkReachabilityManager sharedManager] (AFNetworkReachabilityManager.m:113)
That class, AFNetworkReachabilityManager, has something to do with if the network is reachable or not. Have you tried testing your application under different network situations, like no internet or poor internet connectivity? That might be where they're seeing the crash.

Apple rejected my app due to crash, can't reproduce it

I just uploaded an app to the appstore, it was developed for ios7.
They rejected the app because of a crash I can't reproduce...
They sent me this crash report:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000008
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x000000018e0501c8 objc_msgSend + 8
1 UIKit 0x000000018493e940 __97-[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:]_block_invoke718 + 52
2 UIKit 0x00000001846b6504 -[UIViewController _executeAfterAppearanceBlock] + 60
3 UIKit 0x00000001846b646c _applyBlockToCFArrayCopiedToStack + 352
4 UIKit 0x00000001846224c8 _afterCACommitHandler + 540
5 CoreFoundation 0x00000001816270a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
6 CoreFoundation 0x000000018162432c __CFRunLoopDoObservers + 368
7 CoreFoundation 0x00000001816246b8 __CFRunLoopRun + 760
8 CoreFoundation 0x00000001815656cc CFRunLoopRunSpecific + 448
9 GraphicsServices 0x0000000187201c08 GSEventRunModal + 164
10 UIKit 0x0000000184696fd8 UIApplicationMain + 1152
11 brandnooz 0x00000001000aaa0c 0x100038000 + 469516
12 libdyld.dylib 0x000000018e633a9c start + 0
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x000000018e715aa8 kevent64 + 8
1 libdispatch.dylib 0x000000018e619998 _dispatch_mgr_thread + 48
Thread 2 name: AFNetworking
Thread 2:
0 libsystem_kernel.dylib 0x000000018e715ca0 mach_msg_trap + 8
1 CoreFoundation 0x0000000181626570 __CFRunLoopServiceMachPort + 180
2 CoreFoundation 0x0000000181624700 __CFRunLoopRun + 832
3 CoreFoundation 0x00000001815656cc CFRunLoopRunSpecific + 448
4 Foundation 0x00000001821012c0 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 292
5 Foundation 0x000000018215ed74 -[NSRunLoop(NSRunLoop) run] + 92
6 brandnooz 0x0000000100045280 0x100038000 + 53888
7 Foundation 0x00000001821e8408 __NSThread__main__ + 996
8 libsystem_pthread.dylib 0x000000018e7afe18 _pthread_body + 164
9 libsystem_pthread.dylib 0x000000018e7afd70 _pthread_start + 136
10 libsystem_pthread.dylib 0x000000018e7ad550 thread_start + 0
Thread 3 name: com.apple.NSURLConnectionLoader
Thread 3:
0 libsystem_kernel.dylib 0x000000018e715ca0 mach_msg_trap + 8
1 CoreFoundation 0x0000000181626570 __CFRunLoopServiceMachPort + 180
2 CoreFoundation 0x0000000181624700 __CFRunLoopRun + 832
3 CoreFoundation 0x00000001815656cc CFRunLoopRunSpecific + 448
4 Foundation 0x000000018215a424 +[NSURLConnection(Loader) _resourceLoadLoop:] + 344
5 Foundation 0x00000001821e8408 __NSThread__main__ + 996
6 libsystem_pthread.dylib 0x000000018e7afe18 _pthread_body + 164
7 libsystem_pthread.dylib 0x000000018e7afd70 _pthread_start + 136
8 libsystem_pthread.dylib 0x000000018e7ad550 thread_start + 0
Thread 4 name: com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x000000018e72e76c __select + 8
1 libsystem_pthread.dylib 0x000000018e7afe18 _pthread_body + 164
2 libsystem_pthread.dylib 0x000000018e7afd70 _pthread_start + 136
3 libsystem_pthread.dylib 0x000000018e7ad550 thread_start + 0
Thread 5 name: Dispatch queue: com.apple.root.high-priority
Thread 5:
0 libsystem_kernel.dylib 0x000000018e72e394 __psynch_cvwait + 8
1 Foundation 0x00000001821cf8e0 -[__NSOperationInternal _waitUntilFinished:] + 100
2 brandnooz 0x0000000100083928 0x100038000 + 309544
3 brandnooz 0x00000001000cf3c0 0x100038000 + 619456
4 libdispatch.dylib 0x000000018e618010 _dispatch_call_block_and_release + 20
5 libdispatch.dylib 0x000000018e617fd0 _dispatch_client_callout + 12
6 libdispatch.dylib 0x000000018e61f2b4 _dispatch_root_queue_drain + 552
7 libdispatch.dylib 0x000000018e61f4f8 _dispatch_worker_thread2 + 72
8 libsystem_pthread.dylib 0x000000018e7ad6b8 _pthread_wqthread + 352
9 libsystem_pthread.dylib 0x000000018e7ad548 start_wqthread + 0
Thread 6 name: Dispatch queue: com.apple.root.default-priority
Thread 6:
0 libsystem_kernel.dylib 0x000000018e715cdc semaphore_wait_trap + 8
1 brandnooz 0x00000001000d8044 0x100038000 + 655428
2 libdispatch.dylib 0x000000018e618010 _dispatch_call_block_and_release + 20
3 libdispatch.dylib 0x000000018e617fd0 _dispatch_client_callout + 12
4 libdispatch.dylib 0x000000018e61f2b4 _dispatch_root_queue_drain + 552
5 libdispatch.dylib 0x000000018e61f4f8 _dispatch_worker_thread2 + 72
6 libsystem_pthread.dylib 0x000000018e7ad6b8 _pthread_wqthread + 352
7 libsystem_pthread.dylib 0x000000018e7ad548 start_wqthread + 0
Thread 7 name: Dispatch queue: com.apple.root.high-priority
Thread 7:
0 libsystem_kernel.dylib 0x000000018e72e394 __psynch_cvwait + 8
1 Foundation 0x00000001821cf8e0 -[__NSOperationInternal _waitUntilFinished:] + 100
2 brandnooz 0x0000000100083928 0x100038000 + 309544
3 brandnooz 0x00000001000cf3c0 0x100038000 + 619456
4 libdispatch.dylib 0x000000018e618010 _dispatch_call_block_and_release + 20
5 libdispatch.dylib 0x000000018e617fd0 _dispatch_client_callout + 12
6 libdispatch.dylib 0x000000018e61f2b4 _dispatch_root_queue_drain + 552
7 libdispatch.dylib 0x000000018e61f4f8 _dispatch_worker_thread2 + 72
8 libsystem_pthread.dylib 0x000000018e7ad6b8 _pthread_wqthread + 352
9 libsystem_pthread.dylib 0x000000018e7ad548 start_wqthread + 0
Thread 8 name: Dispatch queue: com.apple.root.default-priority
Thread 8:
0 libsystem_kernel.dylib 0x000000018e715cdc semaphore_wait_trap + 8
1 brandnooz 0x00000001000d8044 0x100038000 + 655428
2 libdispatch.dylib 0x000000018e618010 _dispatch_call_block_and_release + 20
3 libdispatch.dylib 0x000000018e617fd0 _dispatch_client_callout + 12
4 libdispatch.dylib 0x000000018e61f2b4 _dispatch_root_queue_drain + 552
5 libdispatch.dylib 0x000000018e61f4f8 _dispatch_worker_thread2 + 72
6 libsystem_pthread.dylib 0x000000018e7ad6b8 _pthread_wqthread + 352
7 libsystem_pthread.dylib 0x000000018e7ad548 start_wqthread + 0
Thread 9 name: Dispatch queue: com.apple.network.helper_queue
Thread 9:
0 libsystem_kernel.dylib 0x000000018e715ca0 mach_msg_trap + 8
1 libdispatch.dylib 0x000000018e621648 _dispatch_mach_msg_send + 364
2 libdispatch.dylib 0x000000018e61a6d4 dispatch_mach_send + 216
3 libxpc.dylib 0x000000018e7c9814 xpc_connection_send_message_with_reply + 124
4 libsystem_network.dylib 0x000000018e77cfe0 __net_helper_send_block_invoke + 48
5 libdispatch.dylib 0x000000018e617fd0 _dispatch_client_callout + 12
6 libdispatch.dylib 0x000000018e61dc80 _dispatch_barrier_sync_f_invoke + 44
7 libsystem_network.dylib 0x000000018e77ab84 net_helper_send + 212
8 libsystem_network.dylib 0x000000018e77bd4c net_helper_connection_start + 264
9 libsystem_network.dylib 0x000000018e778b78 tcp_connection_register_reachability + 164
10 libsystem_network.dylib 0x000000018e77775c __tcp_connection_start_block_invoke + 312
11 libdispatch.dylib 0x000000018e618010 _dispatch_call_block_and_release + 20
12 libdispatch.dylib 0x000000018e617fd0 _dispatch_client_callout + 12
13 libdispatch.dylib 0x000000018e61e4a4 _dispatch_queue_drain + 636
14 libdispatch.dylib 0x000000018e61a4bc _dispatch_queue_invoke + 64
15 libdispatch.dylib 0x000000018e61f0f0 _dispatch_root_queue_drain + 100
16 libdispatch.dylib 0x000000018e61f4f8 _dispatch_worker_thread2 + 72
17 libsystem_pthread.dylib 0x000000018e7ad6b8 _pthread_wqthread + 352
18 libsystem_pthread.dylib 0x000000018e7ad548 start_wqthread + 0
Thread 10:
0 libsystem_kernel.dylib 0x000000018e72ee74 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x000000018e7ad548 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000008 x1: 0x0000000184d29a89 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000000
x8: 0x000000018f24b4b8 x9: 0x0000000100183460 x10: 0x0000000150882c00 x11: 0x000000520000007f
x12: 0x0000000150883390 x13: 0x000001a500183465 x14: 0x0000000000000006 x15: 0x0000000000000000
x16: 0x000000018e0501c0 x17: 0x00000001846484ec x18: 0x0000000000000000 x19: 0x0000000170053500
x20: 0x000000018f287000 x21: 0x000000016fdc6b28 x22: 0x000000016fdc6b20 x23: 0x000000017012d3e0
x24: 0x000000017012d3f0 x25: 0x000000019157a098 x26: 0x000000016fdc6b20 x27: 0x000000016fdc6d00
x28: 0x0000000000000003 fp: 0x000000016fdc6af0 lr: 0x000000018493e944
sp: 0x000000016fdc6ae0 pc: 0x000000018e0501c8 cpsr: 0x20000000
Please help me to solve this issue. Thanks In Advance
You crashed inside objc_msgSend with an EXC_BAD_ACCESS exception. In my experience this probably means that an object has gone out of scope and you're trying to access it or, the object is supposed to do something on another thread and in the mean time (while it's doing that), its gone out of scope on the original thread.
If you're using one of Apple's multithreaded objects (pretty much anything with delegate callbacks), make sure it is retained (strong-ly) by the object in which it is contained. For example if you're using an object with asynchronous callbacks, you can't just instantiate it inside a method and then let it disappear, you have to make it a strong #property so it remains in scope even when the method returns and you are awaiting the callbacks.
EDIT (Based on CFSocket thread):
By the look of it, you're using a socket API which is commonly used with the NSStream class. Remember to create strong #properties for those NSStream objects (or other connection objects you are using), and, if you're wrapping them inside another object, make sure that it is a strong #property of whichever object is using it. You can't get an asynchronous callback from an object that's not there anymore on the thread that created it.
(Note this is not just a case of messaging an object that has been set to nil. Messages to nil do not crash, they just return nil. The issue is a message being sent to something in memory that you don't own anymore).
EDIT 2 (based on main thread):
Are you sure you own every object that is being used in the View Controller transition? Creating a transient object in a block or asynchronous action could also be causing the EXC_BAD_ACCESS.
From what it looks like, may be two threads are accessing the same variables where one of the threads is corrupting the variables used in the other. It is a synchronization issue. Bad access mostly means you are accessing a variable that is nil
You can integrate a crash reporting tool like www.crashlytics.com in your application. It is very easy to implement and the documentation is available once you download the sdk.
After implementation, test your app throughly and it will tell you the exact lines where your code crashes and you can resolve it.

Resources