How it's possible to the app crash only when downloaded by App Store?

I'm having a hard time to debug a crash in our app. Our app is crashing in devices with iOS 9 and 10 when the user performs multitask and kill the app. So the issue is not that critical but it messes with our crash free statistics.

To get the things a little harder, we are only able to reproduce this issue when the app is downloaded from App Store.

Repro steps:

1) Download the app from App Store

2) Run the app

3) Perform multitask and kill the app

Repro rate in iOS 9 and 10 are 100%!


It's not practical to test our builds releasing the app in AppStore, so we need to find a way to reproduce this locally.

Things we tried:

1) Build using xcode (debug developer schema)

2) Build using xcode (release production schema)

3) Upload a build to testflight and check for crash logs in the device

4) Tried to download the app from app store and then replace with one of the xcode/testflight

5) Tried to uninstall the app store build first and then installed the one of the xcode/testflight

3) Repeated these steps like a trillion of times in multiple devices


The crash logs are attached at the end of my post. But what I can't understand is how a testflgith build is different from an app store build.

Maybe the iOS handle the app differently when downloaded from app store?

Crashlytics pointed out these crashes as heap corruption. From the logs it rly looks like that there is something trying to free a string that was already deallocated. But if we are able to reproduce this in production, the same issue would have to happen at least in a testflight build. At this point this make no sense anymore.


iOS 9:

CRASH_INFO_ENTRY_0: abort() called

CRASH_INFO_ENTRY_1: *** error for object 0x6879fb0: pointer being freed was not allocated
# Organization: companyName
# Platform: ios
# Application: appName TV
# Bundle Identifier: com.companyName.appName
# Issue #: 55748
# Issue ID: 56082027f5d3a7f76b5ee749
# Session ID: 0b8e087f892a427182afc03a98b4859f_DNE_0_v2
# Date: 2018-05-01T13:04:00Z
# OS Version: 9.3.5 (13G36)
# Device: iPad mini
# RAM Free: 9%
# Disk Free: 19%


#0. Crashed: com.apple.main-thread
0  libsystem_kernel.dylib        0x2503ac5c __pthread_kill + 8
1  libsystem_pthread.dylib        0x250e4733 pthread_kill + 62
2  libsystem_c.dylib              0x24fcf0ad abort + 108
3  libsystem_malloc.dylib        0x25064ef7 free + 438
4  libc++.1.dylib                0x24b19809 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() + 20
5  libsystem_c.dylib              0x24fcf9a5 __cxa_finalize_ranges + 300
6  libsystem_c.dylib              0x24f8efad exit + 12
7  UIKit                          0x299b957f -[UIApplication _terminateWithStatus:] + 578
8  UIKit                          0x29bd09bd __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke2019 + 908
9  UIKit                          0x29bd34c9 _runAfterCACommitDeferredBlocks + 268
10 UIKit                          0x29bdf7db _cleanUpAfterCAFlushAndRunDeferredBlocks + 90
11 UIKit                          0x2991db1d _afterCACommitHandler + 84
12 CoreFoundation                0x253716c9 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
13 CoreFoundation                0x2536f9cd __CFRunLoopDoObservers + 280
14 CoreFoundation                0x2536fdff __CFRunLoopRun + 958
15 CoreFoundation                0x252bf229 CFRunLoopRunSpecific + 520
16 CoreFoundation                0x252bf015 CFRunLoopRunInMode + 108
17 GraphicsServices              0x268afac9 GSEventRunModal + 160
18 UIKit                          0x29993189 UIApplicationMain + 144
19 appName                      0x6e4d84 main (AppDelegate.swift:17)
20 (Missing)                      0x24f67873 (Missing)


--


#0. Crashed: com.apple.main-thread
0  libsystem_kernel.dylib        0x2503ac5c __pthread_kill + 8
1  libsystem_pthread.dylib        0x250e4733 pthread_kill + 62
2  libsystem_c.dylib              0x24fcf0ad abort + 108
3  libsystem_malloc.dylib        0x25064ef7 free + 438
4  libc++.1.dylib                0x24b19809 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() + 20
5  libsystem_c.dylib              0x24fcf9a5 __cxa_finalize_ranges + 300
6  libsystem_c.dylib              0x24f8efad exit + 12
7  UIKit                          0x299b957f -[UIApplication _terminateWithStatus:] + 578
8  UIKit                          0x29bd09bd __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke2019 + 908
9  UIKit                          0x29bd34c9 _runAfterCACommitDeferredBlocks + 268
10 UIKit                          0x29bdf7db _cleanUpAfterCAFlushAndRunDeferredBlocks + 90
11 UIKit                          0x2991db1d _afterCACommitHandler + 84
12 CoreFoundation                0x253716c9 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
13 CoreFoundation                0x2536f9cd __CFRunLoopDoObservers + 280
14 CoreFoundation                0x2536fdff __CFRunLoopRun + 958
15 CoreFoundation                0x252bf229 CFRunLoopRunSpecific + 520
16 CoreFoundation                0x252bf015 CFRunLoopRunInMode + 108
17 GraphicsServices              0x268afac9 GSEventRunModal + 160
18 UIKit                          0x29993189 UIApplicationMain + 144
19 appName                      0x6e4d84 main (AppDelegate.swift:17)
20 (Missing)                      0x24f67873 (Missing)


#1. com.apple.libdispatch-manager
0  libsystem_kernel.dylib        0x2503c2f8 kevent_qos + 24
1  libdispatch.dylib              0x24f31d61 _dispatch_mgr_invoke + 256
2  libdispatch.dylib              0x24f31abf _dispatch_mgr_thread$VARIANT$mp + 38


#2. com.twitter.crashlytics.ios.MachExceptionServer
0  libsystem_kernel.dylib        0x250268d0 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x250266d5 mach_msg + 40
2  appName                      0x104a15f CLSMachExceptionServer + 17178975
3  libsystem_pthread.dylib        0x250e385b _pthread_body + 138
4  libsystem_pthread.dylib        0x250e37cf _pthread_start + 110
5  libsystem_pthread.dylib        0x250e1724 thread_start + 8


#3. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib        0x250268d0 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x250266d5 mach_msg + 40
2  CoreFoundation                0x25371ac5 __CFRunLoopServiceMachPort + 136
3  CoreFoundation                0x2536fe4d __CFRunLoopRun + 1036
4  CoreFoundation                0x252bf229 CFRunLoopRunSpecific + 520
5  CoreFoundation                0x252bf015 CFRunLoopRunInMode + 108
6  CFNetwork                      0x259109f7 +[NSURLConnection(Loader) _resourceLoadLoop:] + 486
7  Foundation                    0x25bd94a5 __NSThread__start__ + 1148
8  libsystem_pthread.dylib        0x250e385b _pthread_body + 138
9  libsystem_pthread.dylib        0x250e37cf _pthread_start + 110
10 libsystem_pthread.dylib        0x250e1724 thread_start + 8


#4. AVAudioSession Notify Thread
0  libsystem_kernel.dylib        0x250268d0 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x250266d5 mach_msg + 40
2  CoreFoundation                0x25371ac5 __CFRunLoopServiceMachPort + 136
3  CoreFoundation                0x2536fe4d __CFRunLoopRun + 1036
4  CoreFoundation                0x252bf229 CFRunLoopRunSpecific + 520
5  CoreFoundation                0x252bf015 CFRunLoopRunInMode + 108
6  libAVFAudio.dylib              0x2ac7e225 GenericRunLoopThread::Entry(void*) + 132
7  libAVFAudio.dylib              0x2ac53177 CAPThread::Entry(CAPThread*) + 154
8  libsystem_pthread.dylib        0x250e385b _pthread_body + 138
9  libsystem_pthread.dylib        0x250e37cf _pthread_start + 110
10 libsystem_pthread.dylib        0x250e1724 thread_start + 8


#5. KWIAFNetworking
0  libsystem_kernel.dylib        0x250268d0 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x250266d5 mach_msg + 40
2  CoreFoundation                0x25371ac5 __CFRunLoopServiceMachPort + 136
3  CoreFoundation                0x2536fe4d __CFRunLoopRun + 1036
4  CoreFoundation                0x252bf229 CFRunLoopRunSpecific + 520
5  CoreFoundation                0x252bf015 CFRunLoopRunInMode + 108
6  Foundation                    0x25b08045 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
7  Foundation                    0x25b56a4d -[NSRunLoop(NSRunLoop) run] + 80
8  appName                      0xece02b +[KWIAFURLConnectionOperation networkRequestThreadEntryPoint:] (KWIAFURLConnectionOperation.m:160)
9  Foundation                    0x25bd94a5 __NSThread__start__ + 1148
10 libsystem_pthread.dylib        0x250e385b _pthread_body + 138
11 libsystem_pthread.dylib        0x250e37cf _pthread_start + 110
12 libsystem_pthread.dylib        0x250e1724 thread_start + 8


#6. com.apple.CoreMotion.MotionThread
0  libsystem_kernel.dylib        0x250268d0 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x250266d5 mach_msg + 40
2  CoreFoundation                0x25371ac5 __CFRunLoopServiceMachPort + 136
3  CoreFoundation                0x2536fe4d __CFRunLoopRun + 1036
4  CoreFoundation                0x252bf229 CFRunLoopRunSpecific + 520
5  CoreFoundation                0x252ffdd3 CFRunLoopRun + 98
6  CoreMotion                    0x2a5c5db9 (null) + 71113
7  libsystem_pthread.dylib        0x250e385b _pthread_body + 138
8  libsystem_pthread.dylib        0x250e37cf _pthread_start + 110
9  libsystem_pthread.dylib        0x250e1724 thread_start + 8


#7. com.apple.coreaudio.AQClient
0  libsystem_kernel.dylib        0x250268d0 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x250266d5 mach_msg + 40
2  CoreFoundation                0x25371ac5 __CFRunLoopServiceMachPort + 136
3  CoreFoundation                0x2536fe4d __CFRunLoopRun + 1036
4  CoreFoundation                0x252bf229 CFRunLoopRunSpecific + 520
5  CoreFoundation                0x252bf015 CFRunLoopRunInMode + 108
6  AudioToolbox                  0x2772f675 GenericRunLoopThread::Entry(void*) + 132
7  AudioToolbox                  0x277185af CAPThread::Entry(CAPThread*) + 186
8  libsystem_pthread.dylib        0x250e385b _pthread_body + 138
9  libsystem_pthread.dylib        0x250e37cf _pthread_start + 110
10 libsystem_pthread.dylib        0x250e1724 thread_start + 8


#8. Thread
0  libsystem_kernel.dylib        0x2503b864 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x250e1b35 _pthread_wqthread + 1036
2  libsystem_pthread.dylib        0x250e1718 start_wqthread + 8


#9. com.hackemist.SDWebImageCache
0  libsystem_kernel.dylib        0x25026a00 syscall_thread_switch + 8
1  libsystem_platform.dylib      0x250dd75f _os_lock_handoff_lock_slow + 78
2  libsystem_malloc.dylib        0x2506296d szone_malloc_should_clear + 60
3  libsystem_malloc.dylib        0x250628fb malloc_zone_malloc + 90
4  CoreFoundation                0x252b91c1 _CFRuntimeCreateInstance + 236
5  CoreFoundation                0x2537fa19 __CFStringCreateImmutableFunnel3 + 1532
6  CoreFoundation                0x252ba78b CFStringCreateWithBytes + 50
7  CoreFoundation                0x252e6cf3 CreateStringFromFileSystemRepresentationByAddingPercentEscapes + 526
8  CoreFoundation                0x2538e771 _CFURLCreateWithFileSystemRepresentation + 184
9  CoreFoundation                0x252e8d63 CFURLCreateFromFileSystemRepresentation + 18
10 CoreServicesInternal          0x35d02b09 _FSURLCreateWithPathAndAttributes + 288
11 CoreServicesInternal          0x35d0b057 _GetDirectoryURLs(_CFURLEnumerator*) + 522
12 CoreServicesInternal          0x35d0a88b _URLEnumeratorGetNextURL + 94
13 Foundation                    0x25b7286d -[NSURLDirectoryEnumerator nextObject] + 52
14 CoreFoundation                0x252e401b -[NSEnumerator countByEnumeratingWithState:objects:count:] + 50
15 appName                      0xfd30a5 __45-[SDImageCache cleanDiskWithCompletionBlock:]_block_invoke (SDImageCache.m:549)
16 libdispatch.dylib              0x24f1d823 _dispatch_call_block_and_release + 10
17 libdispatch.dylib              0x24f2a423 _dispatch_queue_drain$VARIANT$mp + 1758
18 libdispatch.dylib              0x24f29a61 _dispatch_queue_invoke$VARIANT$mp + 284
19 libdispatch.dylib              0x24f2c5e9 _dispatch_root_queue_drain + 1560
20 libdispatch.dylib              0x24f2bfcd _dispatch_worker_thread3 + 96
21 libsystem_pthread.dylib        0x250e1b29 _pthread_wqthread + 1024
22 libsystem_pthread.dylib        0x250e1718 start_wqthread + 8


#10. Thread
0  libsystem_kernel.dylib        0x2503b864 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x250e1b35 _pthread_wqthread + 1036
2  libsystem_pthread.dylib        0x250e1718 start_wqthread + 8


#11. Thread
0  libsystem_kernel.dylib        0x2503b864 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x250e1b35 _pthread_wqthread + 1036
2  libsystem_pthread.dylib        0x250e1718 start_wqthread + 8


#12. Thread
0  libsystem_kernel.dylib        0x2503b864 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x250e1b35 _pthread_wqthread + 1036
2  libsystem_pthread.dylib        0x250e1718 start_wqthread + 8


#13. Thread
0  libsystem_kernel.dylib        0x2503b864 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x250e1b35 _pthread_wqthread + 1036
2  libsystem_pthread.dylib        0x250e1718 start_wqthread + 8


#14. Thread
0  libsystem_kernel.dylib        0x2503b864 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x250e1b35 _pthread_wqthread + 1036
2  libsystem_pthread.dylib        0x250e1718 start_wqthread + 8


#15. Thread
0  libsystem_kernel.dylib        0x2503b864 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x250e1b35 _pthread_wqthread + 1036
2  libsystem_pthread.dylib        0x250e1718 start_wqthread + 8



iOS 10:

CRASH_INFO_ENTRY_0: abort() called

CRASH_INFO_ENTRY_1: *** error for object 0x660bfb0: pointer being freed was not allocated

# Organization: companyName
# Platform: ios
# Application: appName TV
# Version: 4.6.12 (398)
# Bundle Identifier: com.companyName.appName
# Issue #: 87471
# Issue ID: 59138cb1be077a4dcc8e0076
# Session ID: 9709cee5807e469db13ff5273444233c_DNE_0_v2
# Date: 2018-05-01T13:16:00Z
# OS Version: 10.3.3 (14G60)
# Device: iPhone 5
# RAM Free: 23.2%
# Disk Free: 7.7%


#0. Crashed: com.apple.main-thread
0  libsystem_kernel.dylib        0x1af29acc __pthread_kill + 8
1  libsystem_pthread.dylib        0x1afe2087 pthread_kill + 62
2  libsystem_c.dylib              0x1aebe95b abort + 108
3  libsystem_malloc.dylib        0x1af630e5 free + 578
4  libc++.1.dylib                0x1a9b1285 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() + 20
5  libsystem_c.dylib              0x1aebf20d __cxa_finalize_ranges + 290
6  libsystem_c.dylib              0x1ae7e1b3 exit + 12
7  UIKit                          0x20a15c77 +[_UIAlertManager hideAlertsForTermination] + 564
8  UIKit                          0x20c098b5 __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke.2095 + 924
9  UIKit                          0x20c0c983 _runAfterCACommitDeferredBlocks + 276
10 UIKit                          0x20bffc93 _cleanUpAfterCAFlushAndRunDeferredBlocks + 524
11 UIKit                          0x209818bd _afterCACommitHandler + 112
12 CoreFoundation                0x1b717803 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
13 CoreFoundation                0x1b715a55 __CFRunLoopDoObservers + 282
14 CoreFoundation                0x1b716017 __CFRunLoopRun + 1358
15 CoreFoundation                0x1b6691af CFRunLoopRunSpecific + 470
16 CoreFoundation                0x1b668fd1 CFRunLoopRunInMode + 104
17 GraphicsServices              0x1ce13b41 GSEventRunModal + 80
18 UIKit                          0x209f1a53 UIApplicationMain + 150
19 appName                      0x5c8704 main (main.swift:23)
20 libdyld.dylib                  0x1ae564eb start + 2


--


#0. Crashed: com.apple.main-thread
0  libsystem_kernel.dylib        0x1af29acc __pthread_kill + 8
1  libsystem_pthread.dylib        0x1afe2087 pthread_kill + 62
2  libsystem_c.dylib              0x1aebe95b abort + 108
3  libsystem_malloc.dylib        0x1af630e5 free + 578
4  libc++.1.dylib                0x1a9b1285 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() + 20
5  libsystem_c.dylib              0x1aebf20d __cxa_finalize_ranges + 290
6  libsystem_c.dylib              0x1ae7e1b3 exit + 12
7  UIKit                          0x20a15c77 +[_UIAlertManager hideAlertsForTermination] + 564
8  UIKit                          0x20c098b5 __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke.2095 + 924
9  UIKit                          0x20c0c983 _runAfterCACommitDeferredBlocks + 276
10 UIKit                          0x20bffc93 _cleanUpAfterCAFlushAndRunDeferredBlocks + 524
11 UIKit                          0x209818bd _afterCACommitHandler + 112
12 CoreFoundation                0x1b717803 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
13 CoreFoundation                0x1b715a55 __CFRunLoopDoObservers + 282
14 CoreFoundation                0x1b716017 __CFRunLoopRun + 1358
15 CoreFoundation                0x1b6691af CFRunLoopRunSpecific + 470
16 CoreFoundation                0x1b668fd1 CFRunLoopRunInMode + 104
17 GraphicsServices              0x1ce13b41 GSEventRunModal + 80
18 UIKit                          0x209f1a53 UIApplicationMain + 150
19 appName                      0x5c8704 main (main.swift:23)
20 libdyld.dylib                  0x1ae564eb start + 2


#1. fmdb.<KWIFMDatabaseQueue: 0x1669c570>
0  libsystem_kernel.dylib        0x1af162fc fsync + 8
1  libsqlite3.dylib              0x1bc02cd1 (null) + 44054
2  libsqlite3.dylib              0x1bc0b29b (null) + 2170
3  libsqlite3.dylib              0x1bc027fd (null) + 42818
4  libsqlite3.dylib              0x1bbf3eb7 (null) + 16492
5  libsqlite3.dylib              0x1bbcd8fb (null) + 2524
6  libsqlite3.dylib              0x1bbeee17 (null) + 51750
7  libsqlite3.dylib              0x1bbe25ab sqlite3_step + 442
8  appName                      0xd50f27 -[KWIFMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] (KWIFMDatabase.m:1042)
9  appName                      0xd511e7 -[KWIFMDatabase executeUpdate:withParameterDictionary:] (KWIFMDatabase.m:1122)
10 appName                      0xd49ad7 __51-[KWIKeyValueDatabase setObject:forKeyedSubscript:]_block_invoke (KWIDatabase.m:108)
11 appName                      0xd53cc7 __33-[KWIFMDatabaseQueue inDatabase:]_block_invoke (KWIFMDatabaseQueue.m:153)
12 libdispatch.dylib              0x1ae29783 _dispatch_client_callout + 22
13 libdispatch.dylib              0x1ae35a35 _dispatch_barrier_sync_f_invoke + 50
14 appName                      0xd53c5b -[KWIFMDatabaseQueue inDatabase:] (KWIFMDatabaseQueue.m:167)
15 appName                      0xd499e7 -[KWIKeyValueDatabase setObject:forKeyedSubscript:] (KWIDatabase.m:103)
16 appName                      0xd4dbf5 -[KWIEventHandler retrieveNewEventPersistentSequentialID] (KWIEventHandler.m:54)
17 appName                      0xd7be37 -[PrivateKiwi(Events) registerEvent:parameters:] (PrivateKiwi+Events.m:27)
18 appName                      0xd3071b +[Kiwi(Events) registerEvent:parameters:] (Kiwi+Events.m:19)
19 appName                      0x863e74 KiwiProviderappNameAnalyticsProvider (KiwiProvider.swift:22)
20 appName                      0x7b3ac8 partial apply for static Analytics.(logEvent(AnalyticsEvent) -> ()).(closure #1) (Analytics.swift:26)
21 appName                      0x7b3b0c partial apply for static Analytics.(executeBlockForProvider(AnalyticsProvider, block : () -> ()) -> ()).(closure #1) (Analytics.swift:95)
22 appName                      0x8d415c thunk (NavigationEventDispatcher.swift)
23 libdispatch.dylib              0x1ae29797 _dispatch_call_block_and_release + 10
24 libdispatch.dylib              0x1ae382db _dispatch_root_queue_drain + 620
25 libdispatch.dylib              0x1ae3800f _dispatch_worker_thread3 + 106
26 libsystem_pthread.dylib        0x1afde87d _pthread_wqthread + 1040
27 libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#2. Thread
0  libsystem_kernel.dylib        0x1af2a73c __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1afde8eb _pthread_wqthread + 1150
2  libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#3. com.apple.root.background-qos
0  libsystem_kernel.dylib        0x1af29878 __psynch_mutexwait + 24
1  libsystem_pthread.dylib        0x1afe34ad _pthread_mutex_lock_wait + 74
2  libsystem_pthread.dylib        0x1afe3675 _pthread_mutex_lock_slow + 256
3  libobjc.A.dylib                0x1a9ed8cd recursive_mutex_tt<false>::lock() + 8
4  libobjc.A.dylib                0x1a9f054b objc_sync_enter + 18
5  appName                      0xd4daf1 -[KWIEventHandler retrieveNewEventPersistentSequentialID] (KWIEventHandler.m:52)
6  appName                      0xd7be37 -[PrivateKiwi(Events) registerEvent:parameters:] (PrivateKiwi+Events.m:27)
7  appName                      0xd3071b +[Kiwi(Events) registerEvent:parameters:] (Kiwi+Events.m:19)
8  appName                      0x863e74 KiwiProviderappNameAnalyticsProvider (KiwiProvider.swift:22)
9  appName                      0x7b3ac8 partial apply for static Analytics.(logEvent(AnalyticsEvent) -> ()).(closure #1) (Analytics.swift:26)
10 appName                      0x7b3b0c partial apply for static Analytics.(executeBlockForProvider(AnalyticsProvider, block : () -> ()) -> ()).(closure #1) (Analytics.swift:95)
11 appName                      0x8d415c thunk (NavigationEventDispatcher.swift)
12 libdispatch.dylib              0x1ae29797 _dispatch_call_block_and_release + 10
13 libdispatch.dylib              0x1ae382db _dispatch_root_queue_drain + 620
14 libdispatch.dylib              0x1ae3800f _dispatch_worker_thread3 + 106
15 libsystem_pthread.dylib        0x1afde87d _pthread_wqthread + 1040
16 libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#4. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib        0x1af14900 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x1af146e1 mach_msg + 44
2  CoreFoundation                0x1b717be3 __CFRunLoopServiceMachPort + 144
3  CoreFoundation                0x1b716065 __CFRunLoopRun + 1436
4  CoreFoundation                0x1b6691af CFRunLoopRunSpecific + 470
5  CoreFoundation                0x1b668fd1 CFRunLoopRunInMode + 104
6  Foundation                    0x1bfbdaf5 <redacted> + 258
7  Foundation                    0x1bfda76d <redacted> + 86
8  UIKit                          0x212f2ad9 -[UIEventFetcher threadMain] + 128
9  Foundation                    0x1c0a18eb <redacted> + 1122
10 libsystem_pthread.dylib        0x1afe093b _pthread_body + 216
11 libsystem_pthread.dylib        0x1afe085d _pthread_start + 234
12 libsystem_pthread.dylib        0x1afde468 thread_start + 8


#5. com.appName.SpinePreloadStartupOperation
0  libobjc.A.dylib                0x1a9fcf12 objc_object::sidetable_retain() + 117
1  libobjc.A.dylib                0x1a9fe8a9 objc::DenseMapBase<objc::DenseMap<DisguisedPtr<objc_object>, unsigned long, true, objc::DenseMapInfo<DisguisedPtr<objc_object> > >, DisguisedPtr<objc_object>, unsigned long, objc::DenseMapInfo<DisguisedPtr<objc_object> >, true>::FindAndConstruct(DisguisedPtr<objc_object> const&) + 16
2  libswiftFoundation.dylib      0x484a7a4 specialized _arrayConditionalCast<A, B>(_:) + 62428
3  libswiftFoundation.dylib      0x484aab8 specialized static Array._conditionallyBridgeFromObjectiveC(_:result:) + 63216
4  libswiftFoundation.dylib      0x4786bd4 static Array._conditionallyBridgeFromObjectiveC(_:result:) + 26588
5  libswiftCore.dylib            0x452a285 _dynamicCastClassToValueViaObjCBridgeable(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*, (anonymous namespace)::_ObjectiveCBridgeableWitnessTable const*, swift::DynamicCastFlags) + 184
6  libswiftCore.dylib            0x4529613 swift_dynamicCast + 2246
7  libswiftCore.dylib            0x4529047 swift_dynamicCast + 762
8  SpineKit                      0x3c9ae44 __swift_memcpy64_8 + 1464
9  SpineKit                      0x3c43c34 __swift_memmove_array32_8 + 4124
10 SpineKit                      0x3c5bea8 swift_rt_swift_isUniquelyReferenced_nonNull_native + 11192
11 SpineKit                      0x3c5c198 swift_rt_swift_isUniquelyReferenced_nonNull_native + 11944
12 SpineKit                      0x3ca4c60 swift_rt_swift_retain + 15328
13 SpineKit                      0x3ca5bac swift_rt_swift_retain + 19244
14 SpineKit                      0x3c8a94c globalinit_33_1E1907A979A7C49ABC5726F24B42723D_func4 + 5172
15 SpineKit                      0x3c6a958 swift_rt_swift_storeEnumTagSinglePayload + 1108
16 appName                      0x701d38 SpinePreloadStartupOperationexecute empty-list Scheduler first-element-marker SchedulerEventevent empty-list  (SpinePreloadStartupOperation.swift:98)
17 appName                      0x700d60 SpinePreloadStartupOperationexecute empty-list Scheduler first-element-marker SchedulerEventevent empty-list  (SpinePreloadStartupOperation.swift)
18 appName                      0x8d415c thunk (NavigationEventDispatcher.swift)
19 libdispatch.dylib              0x1ae29797 _dispatch_call_block_and_release + 10
20 libdispatch.dylib              0x1ae35155 _dispatch_continuation_pop + 384
21 libdispatch.dylib              0x1ae34f0f _dispatch_async_redirect_invoke + 548
22 libdispatch.dylib              0x1ae381b5 _dispatch_root_queue_drain + 326
23 libdispatch.dylib              0x1ae3800f _dispatch_worker_thread3 + 106
24 libsystem_pthread.dylib        0x1afde87d _pthread_wqthread + 1040
25 libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#6. com.hackemist.SDWebImageCache
0  libsystem_kernel.dylib        0x1af28a20 __getattrlist + 20
1  CoreServicesInternal          0x2f1f3f63 corePropertyProviderPrepareValues(__CFURL const*, __FileCache*, __CFString const* const*, void const**, long, void const*, __CFError**) + 468
2  CoreServicesInternal          0x2f1ee56d prepareValuesForBitmap(__CFURL const*, __FileCache*, _FilePropertyBitmap*, __CFError**) + 244
3  CoreServicesInternal          0x2f1ece03 _FSURLCopyResourcePropertiesForKeysInternal(__CFURL const*, __CFArray const*, void*, __CFError**, unsigned char) + 566
4  CoreServicesInternal          0x2f1ecbc9 _FSURLCopyResourcePropertiesForKeys + 18
5  CoreFoundation                0x1b7375f7 CFURLCopyResourcePropertiesForKeys + 220
6  CoreFoundation                0x1b789659 -[NSURL resourceValuesForKeys:error:] + 170
7  appName                      0xe3474b __45-[SDImageCache cleanDiskWithCompletionBlock:]_block_invoke (SDImageCache.m:531)
8  libdispatch.dylib              0x1ae29797 _dispatch_call_block_and_release + 10
9  libdispatch.dylib              0x1ae3659d _dispatch_queue_serial_drain + 854
10 libdispatch.dylib              0x1ae2cb71 _dispatch_queue_invoke + 886
11 libdispatch.dylib              0x1ae36a1f _dispatch_queue_override_invoke + 282
12 libdispatch.dylib              0x1ae381b5 _dispatch_root_queue_drain + 326
13 libdispatch.dylib              0x1ae3800f _dispatch_worker_thread3 + 106
14 libsystem_pthread.dylib        0x1afde87d _pthread_wqthread + 1040
15 libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#7. com.twitter.crashlytics.ios.MachExceptionServer
0  libsystem_kernel.dylib        0x1af14900 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x1af146e1 mach_msg + 44
2  appName                      0xe9be8f CLSMachExceptionServer + 15576719
3  libsystem_pthread.dylib        0x1afe093b _pthread_body + 216
4  libsystem_pthread.dylib        0x1afe085d _pthread_start + 234
5  libsystem_pthread.dylib        0x1afde468 thread_start + 8


#8. Thread
0  libsystem_pthread.dylib        0x1afde454 start_wqthread + 83


#9. Thread
0  libsystem_kernel.dylib        0x1af2a73c __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1afde8eb _pthread_wqthread + 1150
2  libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#10. Thread
0  libsystem_kernel.dylib        0x1af2a73c __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1afde8eb _pthread_wqthread + 1150
2  libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#11. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib        0x1af14900 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x1af146e1 mach_msg + 44
2  CoreFoundation                0x1b717be3 __CFRunLoopServiceMachPort + 144
3  CoreFoundation                0x1b716065 __CFRunLoopRun + 1436
4  CoreFoundation                0x1b6691af CFRunLoopRunSpecific + 470
5  CoreFoundation                0x1b668fd1 CFRunLoopRunInMode + 104
6  CFNetwork                      0x1bd46393 +[NSURLConnection(Loader) _resourceLoadLoop:] + 402
7  Foundation                    0x1c0a18eb <redacted> + 1122
8  libsystem_pthread.dylib        0x1afe093b _pthread_body + 216
9  libsystem_pthread.dylib        0x1afe085d _pthread_start + 234
10 libsystem_pthread.dylib        0x1afde468 thread_start + 8


#12. Thread
0  libsystem_kernel.dylib        0x1af2a73c __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1afde8eb _pthread_wqthread + 1150
2  libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#13. io.answers.EventQueue :: NSOperation 0x165f1ad0 (QOS: BACKGROUND)
0  libsystem_kernel.dylib        0x1af28568 __bsdthread_ctl + 12
1  libsystem_pthread.dylib        0x1afe430b pthread_override_qos_class_end_np + 66
2  Foundation                    0x1c083e13 <redacted> + 408
3  libdispatch.dylib              0x1ae3659d _dispatch_queue_serial_drain + 854
4  libdispatch.dylib              0x1ae2cb71 _dispatch_queue_invoke + 886
5  libdispatch.dylib              0x1ae381b5 _dispatch_root_queue_drain + 326
6  libdispatch.dylib              0x1ae3800f _dispatch_worker_thread3 + 106
7  libsystem_pthread.dylib        0x1afde87d _pthread_wqthread + 1040
8  libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#14. Thread
0  libsystem_kernel.dylib        0x1af2a73c __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1afde8eb _pthread_wqthread + 1150
2  libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#15. AVAudioSession Notify Thread
0  libsystem_kernel.dylib        0x1af14900 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x1af146e1 mach_msg + 44
2  CoreFoundation                0x1b717be3 __CFRunLoopServiceMachPort + 144
3  CoreFoundation                0x1b716065 __CFRunLoopRun + 1436
4  CoreFoundation                0x1b6691af CFRunLoopRunSpecific + 470
5  CoreFoundation                0x1b668fd1 CFRunLoopRunInMode + 104
6  AVFAudio                      0x3227a82f GenericRunLoopThread::Entry(void*) + 142
7  AVFAudio                      0x322a358f CAPThread::Entry(CAPThread*) + 154
8  libsystem_pthread.dylib        0x1afe093b _pthread_body + 216
9  libsystem_pthread.dylib        0x1afe085d _pthread_start + 234
10 libsystem_pthread.dylib        0x1afde468 thread_start + 8


#16. KWIAFNetworking
0  libsystem_kernel.dylib        0x1af14900 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x1af146e1 mach_msg + 44
2  CoreFoundation                0x1b717be3 __CFRunLoopServiceMachPort + 144
3  CoreFoundation                0x1b716065 __CFRunLoopRun + 1436
4  CoreFoundation                0x1b6691af CFRunLoopRunSpecific + 470
5  CoreFoundation                0x1b668fd1 CFRunLoopRunInMode + 104
6  Foundation                    0x1bfbdaf5 <redacted> + 258
7  Foundation                    0x1c00adb9 <redacted> + 80
8  appName                      0xd3aa9f +[KWIAFURLConnectionOperation networkRequestThreadEntryPoint:] (KWIAFURLConnectionOperation.m:160)
9  Foundation                    0x1c0a18eb <redacted> + 1122
10 libsystem_pthread.dylib        0x1afe093b _pthread_body + 216
11 libsystem_pthread.dylib        0x1afe085d _pthread_start + 234
12 libsystem_pthread.dylib        0x1afde468 thread_start + 8


#17. com.apple.CoreMotion.MotionThread
0  libsystem_kernel.dylib        0x1af14900 mach_msg_trap + 20
1  libsystem_kernel.dylib        0x1af146e1 mach_msg + 44
2  CoreFoundation                0x1b717be3 __CFRunLoopServiceMachPort + 144
3  CoreFoundation                0x1b716065 __CFRunLoopRun + 1436
4  CoreFoundation                0x1b6691af CFRunLoopRunSpecific + 470
5  CoreFoundation                0x1b6a91a1 CFRunLoopRun + 104
6  CoreMotion                    0x2179ece9 (null) + 110553
7  libsystem_pthread.dylib        0x1afe093b _pthread_body + 216
8  libsystem_pthread.dylib        0x1afe085d _pthread_start + 234
9  libsystem_pthread.dylib        0x1afde468 thread_start + 8


#18. Thread
0  libsystem_kernel.dylib        0x1af14968 semaphore_timedwait_trap + 8
1  libdispatch.dylib              0x1ae3a9df _os_semaphore_timedwait + 70
2  libdispatch.dylib              0x1ae3a07f _dispatch_semaphore_wait_slow + 56
3  libdispatch.dylib              0x1ae39463 _dispatch_worker_thread + 200
4  libsystem_pthread.dylib        0x1afe093b _pthread_body + 216
5  libsystem_pthread.dylib        0x1afe085d _pthread_start + 234
6  libsystem_pthread.dylib        0x1afde468 thread_start + 8


#19. com.apple.root.background-qos
0  appName                      0xe8c840 +[AppsFlyerTracker sharedTracker] + 15513664
1  appName                      0x7fc914 specialized AppsflyerProvider.startWithLaunchOption([UIApplicationLaunchOptionsKey : Any]) -> () (AppsflyerProvider.swift:21)
2  appName                      0x7fc5a4 AppsflyerProviderappNameAnalyticsProvider (AppsflyerProvider.swift)
3  appName                      0x7b31d8 static Analytics.(startProviders([AnalyticsProvider], launchOptions : [UIApplicationLaunchOptionsKey : Any]) -> ()).(closure #1) (Analytics.swift:17)
4  appName                      0x7b3b0c partial apply for static Analytics.(executeBlockForProvider(AnalyticsProvider, block : () -> ()) -> ()).(closure #1) (Analytics.swift:95)
5  appName                      0x8d415c thunk (NavigationEventDispatcher.swift)
6  libdispatch.dylib              0x1ae29797 _dispatch_call_block_and_release + 10
7  libdispatch.dylib              0x1ae382db _dispatch_root_queue_drain + 620
8  libdispatch.dylib              0x1ae3800f _dispatch_worker_thread3 + 106
9  libsystem_pthread.dylib        0x1afde87d _pthread_wqthread + 1040
10 libsystem_pthread.dylib        0x1afde45c start_wqthread + 8


#20. Thread
0  libsystem_kernel.dylib        0x1af2a73c __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1afde745 _pthread_wqthread + 728
2  libsystem_pthread.dylib        0x1afde45c start_wqthread + 8

Replies

Have you tried running any of the standard memory debugging tools? Memory issues like this can be subtle and may not always reproduce with the same steps. Revealing memory issues through steps to reproduce the crash is non-deterministic, but running a tool like the Address Sanitizer makes the issue deterministic by catching the problem at the time the error actually happens, which is some time before the crash.


In the future, it would be helpful if you can share an Apple format crash log - it has additional useful information that is not included in the format you provided.

Seen Tech QA2151?

https://developer.apple.com/library/content/technotes/tn2151/_index.html


And since you're still back on iOS 9... QA 1747 (dated):

https://developer.apple.com/library/content/qa/qa1747/_index.html


Also, thanks for the crash info, but pls. resist adding hundreds of lines of output to your comment unless specifically requested, thanks.


If you care to edit/reduce the size of your comment, see this post for details: For Best Results - Read the Label

Also been seeing tons of crashes with "first-element-marker" in the stack trace. Seems like it may be a bug in Apple's Swift code.