UserDefaults.standard setValue forKey crash on iOS 15 only.

This crash happens on iOS 15 later only,how can I find the real reason?

My code:

Crash log:

Incident Identifier: 4655B473-CE88-4BB5-99CD-5977B2345823
Hardware Model:      iPhone12,1
Process:             pgAppModule_Example [47353]
Path:                /private/var/containers/Bundle/Application/9E1119C8-DAEC-4A21-8812-1215D4F7644D/pgAppModule_Example.app/pgAppModule_Example
Identifier:          com.360buy.jdpingou
Version:             5.19.0 (100833)
AppStoreTools:       13C90b
AppVariant:          1:iPhone12,1:15
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.360buy.jdpingou [3035]

Date/Time:           2022-01-18 23:32:45.8612 +0800
Launch Time:         2022-01-18 23:27:13.8891 +0800
OS Version:          iPhone OS 15.1 (19B74)
Release Type:        User
Baseband Version:    3.00.00
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000019a9a7af8
Exception Note:  EXC_CORPSE_NOTIFY
Terminating Process: exc handler [47353]
Triggered by Thread:  11


Thread 0 name:
Thread 0:
0   libsystem_platform.dylib      	0x00000001f25dde30 _platform_memset + 176
1   libsystem_malloc.dylib        	0x0000000193ed4314 nanov2_allocate + 344 (nanov2_malloc.c:2633)
2   libsystem_malloc.dylib        	0x0000000193ed482c nanov2_calloc + 160 (nanov2_malloc.c:1072)
3   libsystem_malloc.dylib        	0x0000000193ec30a4 _malloc_zone_calloc + 88 (malloc.c:1638)
4   libobjc.A.dylib               	0x000000019a9a60c0 class_createInstance + 64 (objc-runtime-new.mm:8027)
5   CoreFoundation                	0x00000001822d5988 __CFAllocateObject + 24 (NSObject.m:663)
6   CoreFoundation                	0x00000001822d55ac __NSArrayM_new + 60 (NSArrayM.m:437)
7   CoreFoundation                	0x00000001822d5f7c +[NSArray array] + 36 (NSArray.m:900)
8   pgAppModule_Example           	0x0000000100e10ebc -[KSJSONCodec initWithEncodeOptions:decodeOptions:] + 10325692 (KSJSONCodecObjC.m:129)
9   pgAppModule_Example           	0x0000000100e10e1c +[KSJSONCodec codecWithEncodeOptions:decodeOptions:] + 10325532 (KSJSONCodecObjC.m:121)
10  pgAppModule_Example           	0x0000000100e119d8 +[KSJSONCodec encode:options:error:] + 10328536 (KSJSONCodecObjC.m:421)
11  pgAppModule_Example           	0x0000000100e25b40 -[KSCrash setUserInfo:] + 10410816 (KSCrash.m:178)
12  pgAppModule_Example           	0x0000000100dcfbc4 -[JDCrashManager saveUserInfo] + 10058692 (JDCrashManager.m:445)
13  pgAppModule_Example           	0x0000000100dcf300 __28-[JDCrashManager markEvent:]_block_invoke + 10056448 (JDCrashManager.m:301)
14  libdispatch.dylib             	0x0000000181fb5914 _dispatch_call_block_and_release + 32 (init.c:1517)
15  libdispatch.dylib             	0x0000000181fb7660 _dispatch_client_callout + 20 (object.m:560)
16  libdispatch.dylib             	0x0000000181fc5b60 _dispatch_main_queue_callback_4CF + 944 (inline_internal.h:2601)
17  CoreFoundation                	0x00000001822fdcd4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1795)
18  CoreFoundation                	0x00000001822b7eac __CFRunLoopRun + 2540 (CFRunLoop.c:3144)
19  CoreFoundation                	0x00000001822cb3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
20  GraphicsServices              	0x000000019dc5b38c GSEventRunModal + 164 (GSEvent.c:2200)
21  UIKitCore                     	0x0000000184c6b6a8 -[UIApplication _run] + 1100 (UIApplication.m:3493)
22  UIKitCore                     	0x00000001849ea7f4 UIApplicationMain + 2092 (UIApplication.m:5046)
23  pgAppModule_Example           	0x000000010074613c hook_uiapplication_main + 3203388 (JDAPMLaunchTimeTrack.m:30)
24  pgAppModule_Example           	0x000000010043f974 main + 31092 (main.m:15)
25  dyld                          	0x0000000105af9a24 start + 520 (dyldMain.cpp:876)

Thread 1 name:
Thread 1:
0   libsystem_kernel.dylib        	0x00000001b9186504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b9186b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001822b3688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001822b797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x00000001822cb3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000183ae6354 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6   Foundation                    	0x0000000183b27c28 -[NSRunLoop(NSRunLoop) runUntilDate:] + 92 (NSRunLoop.m:420)
7   UIKitCore                     	0x0000000184be48a4 -[UIEventFetcher threadMain] + 524 (UIEventFetcher.m:1167)
8   Foundation                    	0x0000000183b3636c __NSThread__start__ + 808 (NSThread.m:972)
9   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 2:
0   libsystem_kernel.dylib        	0x00000001b9186ae4 __semwait_signal + 8
1   libsystem_c.dylib             	0x000000018d167f00 nanosleep + 216 (nanosleep.c:104)
2   libsystem_c.dylib             	0x000000018d17bf3c sleep + 48 (sleep.c:62)
3   pgAppModule_Example           	0x0000000100e1f2e8 monitorCachedData + 10384104 (KSCrashCachedData.c:156)
4   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
5   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 3 name:
Thread 3:
0   libsystem_kernel.dylib        	0x00000001b9186504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b9186b9c mach_msg + 76 (mach_msg.c:119)
2   pgAppModule_Example           	0x0000000100de5154 handleExceptions + 10146132 (KSCrashMonitor_MachException.c:281)
3   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
4   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 4 name:
Thread 4:
0   libsystem_kernel.dylib        	0x00000001b9186504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b9186b9c mach_msg + 76 (mach_msg.c:119)
2   pgAppModule_Example           	0x0000000100de5400 handleExceptions + 10146816 (KSCrashMonitor_MachException.c:376)
3   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
4   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 5 name:
Thread 5:
0   libsystem_kernel.dylib        	0x00000001b9186504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b9186b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001822b3688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001822b797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x00000001822cb3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   CoreFoundation                	0x000000018234ba78 CFRunLoopRun + 64 (CFRunLoop.c:3293)
6   CoreMotion                    	0x000000018f2ab544 CLMotionCore::runMotionThread(void*) + 1204 (CLMotionCore.mm:370)
7   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 6 name:
Thread 6:
0   libsystem_kernel.dylib        	0x00000001b9186f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f25ed254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019aa53e78 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::r... + 100 (__threading_support:443)
3   JavaScriptCore                	0x000000018e3f0b10 bmalloc::Scavenger::threadRunLoop() + 704 (__mutex_base:0)
4   JavaScriptCore                	0x000000018e3f0544 bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 16 (Scavenger.cpp:295)
5   JavaScriptCore                	0x000000018e3f1a00 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::Scaveng... + 48 (type_traits:3694)
6   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
7   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 7 name:
Thread 7:
0   libsystem_kernel.dylib        	0x00000001b9186504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b9186b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001822b3688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001822b797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x00000001822cb3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   AudioSession                  	0x000000018b65f308 CADeprecated::GenericRunLoopThread::Entry(void*) + 164 (GenericRunLoopThread.h:95)
6   AudioSession                  	0x000000018b668d64 CADeprecated::CAPThread::Entry(CADeprecated::CAPThread*) + 92 (CAPThread.cpp:324)
7   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 8 name:
Thread 8:
0   libsystem_kernel.dylib        	0x00000001b9186504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b9186b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001822b3688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001822b797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x00000001822cb3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   CFNetwork                     	0x0000000182d3f6a0 +[__CFN_CoreSchedulingSetRunnable _run:] + 464 (CoreSchedulingSet.mm:1372)
6   Foundation                    	0x0000000183b3636c __NSThread__start__ + 808 (NSThread.m:972)
7   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 9 name:
Thread 9:
0   libsystem_kernel.dylib        	0x00000001b9186504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b9186b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001822b3688 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001822b797c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x00000001822cb3b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000183ae6354 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6   pgAppModule_Example           	0x0000000103f27904 -[SRRunLoopThread main] + 61798660 (SRRunLoopThread.m:70)
7   Foundation                    	0x0000000183b3636c __NSThread__start__ + 808 (NSThread.m:972)
8   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
9   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 10 name:
Thread 10:
0   libsystem_kernel.dylib        	0x00000001b91871d0 select$DARWIN_EXTSN + 8
1   CoreFoundation                	0x0000000182356740 __CFSocketManager + 648 (CFSocket.c:1343)
2   libsystem_pthread.dylib       	0x00000001f25e69a4 _pthread_start + 148 (pthread.c:891)
3   libsystem_pthread.dylib       	0x00000001f25e5ea0 thread_start + 8

Thread 11 name:
Thread 11 Crashed:
0   libobjc.A.dylib               	0x000000019a9a7af8 object_getClass + 48 (objc-object.h:237)
1   Foundation                    	0x0000000183b0fbac _NSKeyValueObservationInfoGetObservances + 264 (NSKeyValueObservationInfo.m:792)
2   Foundation                    	0x0000000183b11198 NSKeyValueWillChange + 176 (NSKeyValueObserving.m:467)
3   Foundation                    	0x0000000183af9ea0 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 428 (NSKeyValueObserving.m:2607)
4   Foundation                    	0x0000000183b18708 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 824 (NSKeyValueObserving.m:2580)
5   CoreFoundation                	0x000000018230c508 -[CFPrefsSource forEachObserver:] + 328 (CFPrefsSource.m:665)
6   CoreFoundation                	0x00000001823a6e34 -[CFPrefsSource _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 112 (CFPrefsSource.m:814)
7   CoreFoundation                	0x0000000182381f1c ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke + 440 (CFXPreferences.m:210)
8   CoreFoundation                	0x00000001822d7e6c __CFDictionaryApplyFunction_block_invoke + 28 (CFDictionary.c:334)
9   CoreFoundation                	0x00000001822d5734 CFBasicHashApply + 144 (CFBasicHash.c:1029)
10  CoreFoundation                	0x00000001822d7648 CFDictionaryApplyFunction + 328 (CFDictionary.c:333)
11  CoreFoundation                	0x000000018236d184 _CFPrefsDeliverPendingKVONotificationsGuts + 300 (CFXPreferences.m:69)
12  CoreFoundation                	0x00000001822d46d4 -[_CFXPreferences _deliverPendingKVONotifications] + 96 (CFXPreferences.m:1146)
13  CoreFoundation                	0x0000000182303324 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 432 (CFPrefsSearchListSource.m:1731)
14  CoreFoundation                	0x00000001822db328 normalizeQuintuplet + 356 (CFPrefsSearchListSource.m:74)
15  CoreFoundation                	0x00000001822d43ac -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 152 (CFPrefsSearchListSource.m:1600)
16  CoreFoundation                	0x0000000182385050 -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 128 (CFXPreferences.m:858)
17  CoreFoundation                	0x00000001823087fc _CFPreferencesSetAppValueWithContainerAndConfiguration + 136 (CFXPreferences.m:1970)
18  Foundation                    	0x0000000183b08d24 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 84 (NSUserDefaults.m:228)
19  pgAppModule_Example           	0x000000010269b9c0 closure #1 in HermesCache.push(type:target:trace:completionHandler:) + 36059584 (<compiler-generated>:0)
20  pgAppModule_Example           	0x0000000101ee4ad0 thunk for @escaping @callee_guaranteed () -> () + 27970256 (<compiler-generated>:0)
21  libdispatch.dylib             	0x0000000181fb5914 _dispatch_call_block_and_release + 32 (init.c:1517)
22  libdispatch.dylib             	0x0000000181fb7660 _dispatch_client_callout + 20 (object.m:560)
23  libdispatch.dylib             	0x0000000181fbede4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
24  libdispatch.dylib             	0x0000000181fbf958 _dispatch_lane_invoke + 392 (queue.c:3937)
25  libdispatch.dylib             	0x0000000181fca1a8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
26  libsystem_pthread.dylib       	0x00000001f25e60f4 _pthread_wqthread + 288 (pthread.c:2541)
27  libsystem_pthread.dylib       	0x00000001f25e5e94 start_wqthread + 8

Thread 12:
0   libsystem_pthread.dylib       	0x00000001f25e5e8c start_wqthread + 0

Thread 13 name:
Thread 13:
0   libobjc.A.dylib               	0x000000019a9aa2a8 bool objc::DenseMapBase<objc::DenseMap<DisguisedPtr<objc_object>, unsigned long, (anonymous namespace)::RefcountMapValuePurgeable, objc::DenseMapInfo<DisguisedPtr<objc_object> >, objc::detail::Dens... + 124 (llvm-DenseMap.h:703)
1   libobjc.A.dylib               	0x000000019a9a5e50 objc_object::sidetable_clearDeallocating() + 124 (llvm-DenseMap.h:189)
2   libobjc.A.dylib               	0x000000019a9a8c54 objc_destructInstance + 144 (objc-object.h:541)
3   libdispatch.dylib             	0x0000000181fb6328 _dispatch_dispose + 216 (object.c:177)
4   libxpc.dylib                  	0x00000001f261b8f0 _xpc_serializer_dispose + 80 (serializer.c:246)
5   libxpc.dylib                  	0x00000001f2626824 -[OS_xpc_object dealloc] + 28 (object.m:26)
6   Foundation                    	0x0000000183b12c14 -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 1692 (NSXPCConnection.m:1678)
7   Foundation                    	0x0000000183b487cc _NSXPCDistantObjectSimpleMessageSend0 + 52 (NSXPCDistantObject.m:252)
8   AudioToolbox                  	0x000000018ccee108 -[AVHapticClient stopPrewarm] + 308 (AVHapticClient.mm:351)
9   AudioToolbox                  	0x000000018ce640c8 -[AVHapticPlayer stopPrewarm] + 368 (AVHapticPlayer.mm:1023)
10  CoreHaptics                   	0x000000018cf5370c -[CHHapticEngine stopPrewarm] + 352 (CHHapticEngine.mm:1099)
11  UIKitCore                     	0x0000000184bdf15c -[_UIFeedbackCoreHapticsEngine _internal_cooldownUnderlyingPlayerIfPossibleWithCompletion:] + 344 (_UIFeedbackCoreHapticsEngine.m:353)
12  UIKitCore                     	0x0000000184c003cc -[_UIFeedbackEngine _internal_cooldownEngineIfPossible] + 500 (_UIFeedbackEngine.m:734)
13  UIKitCore                     	0x0000000184be041c -[_UIFeedbackEngine _internal_updateSuspension] + 148 (_UIFeedbackEngine.m:314)
14  UIKitCore                     	0x0000000184a81498 -[_UIFeedbackEngine _internal_setSuspended:] + 396 (_UIFeedbackEngine.m:289)
15  libdispatch.dylib             	0x0000000181fb5914 _dispatch_call_block_and_release + 32 (init.c:1517)
16  libdispatch.dylib             	0x0000000181fb7660 _dispatch_client_callout + 20 (object.m:560)
17  libdispatch.dylib             	0x0000000181fbede4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
18  libdispatch.dylib             	0x0000000181fbf958 _dispatch_lane_invoke + 392 (queue.c:3937)
19  libdispatch.dylib             	0x0000000181fca1a8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
20  libsystem_pthread.dylib       	0x00000001f25e60f4 _pthread_wqthread + 288 (pthread.c:2541)
21  libsystem_pthread.dylib       	0x00000001f25e5e94 start_wqthread + 8

Thread 14 name:
Thread 14:
0   libsystem_kernel.dylib        	0x00000001b9189a94 __rename + 8
1   libsystem_kernel.dylib        	0x00000001b918b964 rename + 20 (rename.c:30)
2   Foundation                    	0x0000000183c4ab38 _NSMoveTemporaryFileToDestination + 168 (NSPlatform.m:1295)
3   Foundation                    	0x0000000183c30654 +[NSKeyedArchiver archiveRootObject:toFile:] + 304 (NSKeyedArchiver.m:727)
4   pgAppModule_Example           	0x0000000100dd1f44 __31-[JDCrashManager saveOOMState:]_block_invoke + 10067780 (JDCrashManager.m:875)
5   libdispatch.dylib             	0x0000000181fb5914 _dispatch_call_block_and_release + 32 (init.c:1517)
6   libdispatch.dylib             	0x0000000181fb7660 _dispatch_client_callout + 20 (object.m:560)
7   libdispatch.dylib             	0x0000000181fbede4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
8   libdispatch.dylib             	0x0000000181fbf958 _dispatch_lane_invoke + 392 (queue.c:3937)
9   libdispatch.dylib             	0x0000000181fca1a8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
10  libsystem_pthread.dylib       	0x00000001f25e60f4 _pthread_wqthread + 288 (pthread.c:2541)
11  libsystem_pthread.dylib       	0x00000001f25e5e94 start_wqthread + 8

Thread 15 name:
Thread 15:
0   libsystem_kernel.dylib        	0x00000001b9187228 __ulock_wake + 8
1   libsystem_platform.dylib      	0x00000001f25de140 _os_unfair_lock_unlock_slow + 56 (lock.c:618)
2   libobjc.A.dylib               	0x000000019a9a7fec look_up_class + 184 (lock_private.h:774)
3   Foundation                    	0x0000000183b04a54 _decodeObjectBinary + 492 (NSKeyedArchiver.m:0)
4   Foundation                    	0x0000000183b4b5b8 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1404 (NSKeyedArchiver.m:3638)
5   Foundation                    	0x0000000183b44490 -[NSDictionary(NSDictionary) initWithCoder:] + 180 (NSDictionary_Foundation.m:89)
6   Foundation                    	0x0000000183b05268 _decodeObjectBinary + 2560 (NSKeyedArchiver.m:3058)
7   Foundation                    	0x0000000183ae9a78 _decodeObject + 180 (NSKeyedArchiver.m:3324)
8   Foundation                    	0x0000000183b09304 -[NSKeyedUnarchiver decodeObjectForKey:] + 176 (NSKeyedArchiver.m:3344)
9   Foundation                    	0x0000000183aff964 -[NSKeyedUnarchiver decodeObjectOfClasses:forKey:] + 360 (NSKeyedArchiver.m:3378)
10  Foundation                    	0x0000000183b8d6d4 -[NSError initWithCoder:] + 520 (NSError.m:471)
11  Foundation                    	0x0000000183b05268 _decodeObjectBinary + 2560 (NSKeyedArchiver.m:3058)
12  Foundation                    	0x0000000183ae9a78 _decodeObject + 180 (NSKeyedArchiver.m:3324)
13  Foundation                    	0x0000000183b09304 -[NSKeyedUnarchiver decodeObjectForKey:] + 176 (NSKeyedArchiver.m:3344)
14  Foundation                    	0x0000000183aff964 -[NSKeyedUnarchiver decodeObjectOfClasses:forKey:] + 360 (NSKeyedArchiver.m:3378)
15  RunningBoardServices          	0x000000018d1e7634 _BSXPCDecodeObject + 1416 (RBSXPCCoder.m:545)
16  RunningBoardServices          	0x000000018d1e858c _BSXPCDecodeObjectForKey + 216 (RBSXPCCoder.m:392)
17  RunningBoardServices          	0x000000018d1ecea0 -[RBSXPCMessage sendToConnection:error:] + 680 (RBSXPCUtilities.m:254)
18  RunningBoardServices          	0x000000018d1f39b4 -[RBSXPCMessage invokeOnConnection:withReturnCollectionClass:entryClass:error:] + 104 (RBSXPCUtilities.m:309)
19  RunningBoardServices          	0x000000018d1e5e30 -[RBSXPCMessage invokeOnConnection:withReturnClass:error:] + 32 (RBSXPCUtilities.m:328)
20  RunningBoardServices          	0x000000018d1fcd98 -[RBSConnection acquireAssertion:error:] + 364 (RBSConnection.m:263)
21  RunningBoardServices          	0x000000018d206c90 -[RBSAssertion acquireWithError:] + 208 (RBSAssertion.m:91)
22  WebKit                        	0x0000000190e44a84 WebKit::ProcessAssertion::acquireSync() + 68 (ProcessAssertionIOS.mm:371)
23  WebKit                        	0x0000000190e4e2c8 WTF::Detail::CallableWrapper<WebKit::ProcessAssertion::acquireAsync(WTF::CompletionHandler<void ()>&&)::$_7, void>::call() + 36 (ProcessAssertionIOS.mm:360)
24  JavaScriptCore                	0x000000018e3dc01c void WTF::dispatchWorkItem<WTF::(anonymous namespace)::DispatchWorkItem>(void*) + 60 (Function.h:82)
25  libdispatch.dylib             	0x0000000181fb7660 _dispatch_client_callout + 20 (object.m:560)
26  libdispatch.dylib             	0x0000000181fbede4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
27  libdispatch.dylib             	0x0000000181fbf958 _dispatch_lane_invoke + 392 (queue.c:3937)
28  libdispatch.dylib             	0x0000000181fca1a8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
29  libsystem_pthread.dylib       	0x00000001f25e60f4 _pthread_wqthread + 288 (pthread.c:2541)
30  libsystem_pthread.dylib       	0x00000001f25e5e94 start_wqthread + 8

Thread 16:
0   libsystem_pthread.dylib       	0x00000001f25e5e8c start_wqthread + 0

Thread 17:
0   libsystem_pthread.dylib       	0x00000001f25e5e8c start_wqthread + 0


Thread 11 crashed with ARM Thread State (64-bit):
    x0: 0x00000002833ee740   x1: 0x00000001cc7818d7   x2: 0x0000000000000000   x3: 0x0000000000000001
    x4: 0x0000000000000001   x5: 0x0000000282786140   x6: 0x0000000183b8b378   x7: 0x000000016fad9ae0
    x8: 0x0000af0f29e4e740   x9: 0x0000000000000002  x10: 0x000000010dcb209f  x11: 0x003f00011a15a000
   x12: 0x0000000000000026  x13: 0x000000011a15a250  x14: 0x000000006ac00000  x15: 0x00000001dba69848
   x16: 0x0000af0f29e4e740  x17: 0x0000000f29e4e740  x18: 0x0000000000000000  x19: 0x0000000282a3e640
   x20: 0x000000016fad9970  x21: 0x0000000000000010  x22: 0x0000000000000002  x23: 0x000000016fad98a0
   x24: 0x0000000000000001  x25: 0x00000001cc7c47fe  x26: 0x000000016fad98e8  x27: 0x00000001dba6a0b8
   x28: 0x00000002829fe8b0   fp: 0x000000016fad9960   lr: 0x0000000183b0fbac
    sp: 0x000000016fad98a0   pc: 0x000000019a9a7af8 cpsr: 0x20000000
   esr: 0xf200c472 (Breakpoint) pointer authentication trap DA


Binary Images:
0x100438000 - 0x104723fff pgAppModule_Example arm64  <5174bcd891cc397cadf8c69535e59b34> /private/var/containers/Bundle/Application/9E1119C8-DAEC-4A21-8812-1215D4F7644D/pgAppModule_Example.app/pgAppModule_Example
0x105ae0000 - 0x105b37fff dyld arm64e  <c21dba379df93fc7b286734030e18bb1> /usr/lib/dyld
0x181fb3000 - 0x181ff9fff libdispatch.dylib arm64e  <a5cbaab3e3893548baacfab18411b94a> /usr/lib/system/libdispatch.dylib
0x1822ac000 - 0x1826fffff CoreFoundation arm64e  <b2d21cfd378c36d5baf73f70599cfefc> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x182ac5000 - 0x182f89fff CFNetwork arm64e  <1f9e80ee1df136acbdfe22afb9a1b82e> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x183ace000 - 0x183dd3fff Foundation arm64e  <d59c69755af237bc93be43b80b4293a5> /System/Library/Frameworks/Foundation.framework/Foundation
0x184752000 - 0x185fd6fff UIKitCore arm64e  <8388eb03002b3b35a78a6a022894292e> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x18b659000 - 0x18b682fff AudioSession arm64e  <99ff741f34943edf82b7c03c916ebad3> /System/Library/PrivateFrameworks/AudioSession.framework/AudioSession
0x18ccbd000 - 0x18cf4afff AudioToolbox arm64e  <0536a3e8cf2433868074769d128ae2ca> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x18cf4b000 - 0x18cf9efff CoreHaptics arm64e  <7fb7fd3ed3fc3529ab0ddbe366aa12a0> /System/Library/Frameworks/CoreHaptics.framework/CoreHaptics
0x18d163000 - 0x18d1e1fff libsystem_c.dylib arm64e  <30a1668a329d30009f747b42b21fe0fd> /usr/lib/system/libsystem_c.dylib
0x18d1e2000 - 0x18d239fff RunningBoardServices arm64e  <9152db1c42303311****9c618c879514> /System/Library/PrivateFrameworks/RunningBoardServices.framework/RunningBoardServices
0x18d23a000 - 0x18e4fafff JavaScriptCore arm64e  <488fd070baee3b55ac28cee0d299f2b2> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
0x18f298000 - 0x18f5a4fff CoreMotion arm64e  <7464cd4b1ec7342392ce51becea40ca3> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
0x190a4d000 - 0x1913b0fff WebKit arm64e  <8a23c64c4eb53360a63035c17c1d99d9> /System/Library/Frameworks/WebKit.framework/WebKit
0x193ebf000 - 0x193edffff libsystem_malloc.dylib arm64e  <98559bb8a1a93f168f5f863d89a026a7> /usr/lib/system/libsystem_malloc.dylib
0x19a9a4000 - 0x19a9ddfff libobjc.A.dylib arm64e  <10fa90c6dfe538aeb3dc2251181cc272> /usr/lib/libobjc.A.dylib
0x19aa4a000 - 0x19aaadfff libc++.1.dylib arm64e  <255864c483d93bac8c7aad1b2d8a60cc> /usr/lib/libc++.1.dylib
0x19dc5a000 - 0x19dc62fff GraphicsServices arm64e  <44e4515eb18737f18fe028e7b087daf5> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1b9185000 - 0x1b91b8fff libsystem_kernel.dylib arm64e  <b1b942de75903c61980a19d80ed4da37> /usr/lib/system/libsystem_kernel.dylib
0x1f25dd000 - 0x1f25e3fff libsystem_platform.dylib arm64e  <8450ed47209c30a5a0eccc569c28facd> /usr/lib/system/libsystem_platform.dylib
0x1f25e5000 - 0x1f25f0fff libsystem_pthread.dylib arm64e  <1a4a45fd1bb639df84140590ce103717> /usr/lib/system/libsystem_pthread.dylib
0x1f2600000 - 0x1f2637fff libxpc.dylib arm64e  <c4b164ee546f365786ee230d897ef6a0> /usr/lib/system/libxpc.dylib

EOF

It's good to post screenshot but you should also post as code text, that's easier to handle.

  • where does it crash exactly: on targets definition ? on traces definition ?
  • which Xcode version (should test with 13.2..1)
  • How is queue defined ?

Note: you could rewrite the test as

            let newTrace = (trace != nil && !trace!.isEmpty) ? trace! : "0"

setValue(forKey:) is a key-value coding (KVC) method. You should be using the UserDefaults specific method, namely set(forKey:). I don’t think that’ll fix this problem, but it’s the right thing to do regardless.

Also, the screen shot you posted doesn’t align with the crash report. The former indicates a force unwrap issue whereas the latter shows a crash deep within UserDefaults. Are you chasing two issues? If not, why this disparity?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Does anyone find the wayout? I got same question when invoke [[NSUserDefaults standardUserDefaults] setObject:value forKey:key] in sub thread.

Incident Identifier: 4363DB7C-AEF6-4DA0-9F1F-3EBFE29297F1
Hardware Model:      iPhone13,2
Process:             *** [2248]
Path:                /private/var/containers/Bundle/Application/47DE2018-8822-44A3-BA9E-47739353C835/xxxx.app/zz
Identifier:          com.hello.here
Version:             8.7.0 (8.7.0.20)
AppStoreTools:       13F100
AppVariant:          1:iPhone13,2:15
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.hello.here [609]

Date/Time:           2022-08-16 17:07:52.4380 +0800
Launch Time:         2022-08-16 17:05:54.1520 +0800
OS Version:          iPhone OS 15.3.1 (19D52)
Release Type:        User
Baseband Version:    2.23.02
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001990c3a58
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  24


Thread 0 name:
Thread 0:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   Foundation                    	0x00000001821c5ff4 -[_NSThreadPerformInfo wait] + 68 (NSThread.m:261)
3   Foundation                    	0x00000001820b8054 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 784 (NSThread.m:1266)
4   Foundation                    	0x00000001820d4a80 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 120 (NSThread.m:1290)
5   myApp                       	0x0000000106b2d69c -[NSThread(GTSDK) gtsdk_unSafePerformWaitingUntilDone:block:] + 176
6   myApp                       	0x0000000106b2d8ac +[NSThread(GTSDK) gtsdk_unSafePerformWaitingUntilDone:block:] + 116
7   myApp                       	0x0000000106b21278 -[GtSdkManager destroySdk] + 304
8   myApp                       	0x0000000106b1c3e8 +[GeTuiSdk destroy] + 84
9   myApp                       	0x00000001042c5f08 static PushNotification.start(delegate:) + 500 (PushNotification.swift:97)
10  myApp                       	0x0000000105b5c578 specialized static ZLMainModule.start(with:) + 776 (ZLMainModule.swift:87)
11  myApp                       	0x000000010447dc44 $s10ModularKit4BootC5start4withySDySo29UIApplicationLaunchOptionsKeyaypGSg_tFZyAA10ModuleType_pXpXEfU_ + 16 (Boot.swift:40)
12  myApp                       	0x000000010447dc44 $s10ModularKit10ModuleType_pXmTs5Error_pIgyzo_AaB_pXmTsAC_pIegnzo_TR + 16 (:0)
13  myApp                       	0x000000010447dc44 $sSTsE7forEachyyy7ElementQzKXEKFSay10ModularKit10ModuleType_pXpG_Tg5 + 24 (:0)
14  myApp                       	0x000000010447dc44 specialized static Boot.start(with:) + 116 (Boot.swift:39)
15  myApp                       	0x0000000104122c88 AppDelegateProxy.identitySwitchingB() + 208 (AppDelegateProxy.swift:327)
16  myApp                       	0x0000000104122fa0 @objc AppDelegateProxy.identitySwitchingB() + 28 (:0)
17  myApp                       	0x00000001041224f4 closure #2 in AppDelegateProxy.setupIdentity() + 464 (AppDelegateProxy.swift:0)
18  myApp                       	0x00000001053b7d0c closure #1 in UserDefault<a>.callAsFunction(onChange:) + 212 (UserDefault.swift:116)
19  myApp                       	0x00000001053b936c specialized UserDefaultObserver.observeValue(forKeyPath:of:change:context:) + 448 (UserDefaultObserver.swift:27)
20  myApp                       	0x00000001053b8f50 $s11UserDefault0aB8ObserverC12observeValue10forKeyPath2of6change7contextySSSg_ypSgSDySo05NSKeye6ChangeG0aypGSgSvSgtF + 20 (:0)
21  myApp                       	0x00000001053b8f50 @objc UserDefaultObserver.observeValue(forKeyPath:of:change:context:) + 244
22  Foundation                    	0x00000001820430cc NSKeyValueNotifyObserver + 292 (NSKeyValueObserving.m:433)
23  Foundation                    	0x000000018202ed90 NSKeyValueDidChange + 356 (NSKeyValueObserving.m:552)
24  Foundation                    	0x000000018203cfe8 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 644 (NSKeyValueObserving.m:2637)
25  Foundation                    	0x000000018205b888 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 824 (NSKeyValueObserving.m:2580)
26  CoreFoundation                	0x000000018084c5b8 -[CFPrefsSource forEachObserver:] + 328 (CFPrefsSource.m:665)
27  CoreFoundation                	0x00000001808e6ee4 -[CFPrefsSource _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 112 (CFPrefsSource.m:814)
28  CoreFoundation                	0x00000001808c1fcc ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke + 440 (CFXPreferences.m:210)
29  CoreFoundation                	0x0000000180817f1c __CFDictionaryApplyFunction_block_invoke + 28 (CFDictionary.c:334)
30  CoreFoundation                	0x00000001808157e4 CFBasicHashApply + 144 (CFBasicHash.c:1029)
31  CoreFoundation                	0x00000001808176f8 CFDictionaryApplyFunction + 328 (CFDictionary.c:333)
32  CoreFoundation                	0x00000001808ad234 _CFPrefsDeliverPendingKVONotificationsGuts + 300 (CFXPreferences.m:69)
33  CoreFoundation                	0x0000000180814784 -[_CFXPreferences _deliverPendingKVONotifications] + 96 (CFXPreferences.m:1146)
34  CoreFoundation                	0x00000001808433d4 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 432 (CFPrefsSearchListSource.m:1731)
35  CoreFoundation                	0x000000018081b3d8 normalizeQuintuplet + 356 (CFPrefsSearchListSource.m:74)
36  CoreFoundation                	0x000000018081445c -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 152 (CFPrefsSearchListSource.m:1600)
37  CoreFoundation                	0x00000001808c5100 -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 128 (CFXPreferences.m:858)
38  CoreFoundation                	0x00000001808488ac _CFPreferencesSetAppValueWithContainerAndConfiguration + 136 (CFXPreferences.m:1970)
39  Foundation                    	0x000000018204bda4 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 84 (NSUserDefaults.m:228)
40  myApp                       	0x00000001053b77c4 closure #1 in UserDefault</a><a>.init(key:defaultValue:) + 260 (UserDefault.swift:100)
41  myApp                       	0x00000001053b88a8 specialized UserDefault.wrappedValue.setter + 20 (UserDefault.swift:19)
42  myApp                       	0x00000001053b69fc UserDefault.wrappedValue.setter + 28 (:0)
43  myApp                       	0x0000000104489f48 static UserInfo.viewMode.setter + 72
44  myApp                       	0x00000001043b6d50 closure #1 in UserIdentityController.viewDidLoad() + 36
45  myApp                       	0x00000001043b7218 partial apply for closure #2 in UserIdentityController.viewDidLoad() + 24 (:0)
46  myApp                       	0x00000001043b7c5c @objc UserIdentitySelectView.employeeEvent() + 60
47  UIKitCore                     	0x0000000182e748f0 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 56 (UIGestureRecognizer.m:136)
48  UIKitCore                     	0x0000000182e3daec _UIGestureRecognizerSendTargetActions + 316 (UIGestureRecognizer.m:1484)
49  UIKitCore                     	0x0000000182e06770 _UIGestureRecognizerSendActions + 284 (UIGestureRecognizer.m:1520)
50  UIKitCore                     	0x0000000182e3fdd4 -[UIGestureRecognizer _updateGestureForActiveEvents] + 636 (UIGestureRecognizer.m:0)
51  UIKitCore                     	0x0000000182df7fe0 _UIGestureEnvironmentUpdate + 1988 (UIGestureEnvironment.m:206)
52  UIKitCore                     	0x0000000182e2bd8c -[UIGestureEnvironment _updateForEvent:window:] + 784 (UIGestureEnvironment.m:1332)
53  UIKitCore                     	0x0000000182e38f2c -[UIWindow sendEvent:] + 4428 (UIWindow.m:3265)
54  UIKitCore                     	0x0000000182fe8e34 -[UIApplication sendEvent:] + 828 (UIApplication.m:11877)
55  UIKitCore                     	0x0000000182e0c140 __dispatchPreprocessedEventFromEventQueue + 7904 (UIEventDispatcher.m:2290)
56  UIKitCore                     	0x0000000182e00f2c __processEventQueue + 6760 (UIEventDispatcher.m:2597)
57  UIKitCore                     	0x0000000183c47d54 updateCycleEntry + 176 (UIEventDispatcher.m:102)
58  UIKitCore                     	0x0000000183472b44 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:112)
59  UIKitCore                     	0x0000000183aef84c schedulerStepScheduledMainSection + 144 (_UIUpdateCycleScheduler.m:1174)
60  UIKitCore                     	0x0000000183aeee3c runloopSourceCallback + 60 (_UIUpdateCycleScheduler.m:1262)
61  CoreFoundation                	0x00000001808a70d0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1972)
62  CoreFoundation                	0x00000001808b7d90 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2016)
63  CoreFoundation                	0x00000001807f2098 __CFRunLoopDoSources0 + 268 (CFRunLoop.c:2053)
64  CoreFoundation                	0x00000001807f78a4 __CFRunLoopRun + 820 (CFRunLoop.c:2951)
65  CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
66  GraphicsServices              	0x000000019c3af38c GSEventRunModal + 164 (GSEvent.c:2200)
67  UIKitCore                     	0x00000001831ae5d0 -[UIApplication _run] + 1100 (UIApplication.m:3493)
68  UIKitCore                     	0x0000000182f2cf74 UIApplicationMain + 364 (UIApplication.m:5047)
69  myApp                       	0x000000010411f644 main + 132 (main.swift:15)
70  dyld                          	0x000000010a55daa4 start + 520 (dyldMain.cpp:879)

Thread 1 name:
Thread 1:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   AudioSession                  	0x0000000189c26308 CADeprecated::GenericRunLoopThread::Entry(void*) + 164 (GenericRunLoopThread.h:95)
6   AudioSession                  	0x0000000189c2fd64 CADeprecated::CAPThread::Entry(CADeprecated::CAPThread*) + 92 (CAPThread.cpp:324)
7   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 2 name:
Thread 2:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000182029c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6   myApp                       	0x00000001054ca01c -[WXBridgeManager _runLoopThread] + 256 (WXBridgeManager.m:123)
7   Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
8   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
9   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 3 name:
Thread 3:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000182029c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6   Foundation                    	0x000000018206adb8 -[NSRunLoop(NSRunLoop) runUntilDate:] + 92 (NSRunLoop.m:420)
7   UIKitCore                     	0x000000018312774c -[UIEventFetcher threadMain] + 524 (UIEventFetcher.m:1167)
8   Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 4 name:
Thread 4:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019916fddc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:437)
3   JavaScriptCore                	0x000000018c9e9174 void std::__1::condition_variable_any::wait >(std::__1::unique_lock&) + 108 (condition_variable:203)
4   JavaScriptCore                	0x000000018c9ed944 bmalloc::Scavenger::threadRunLoop() + 340 (condition_variable:212)
5   JavaScriptCore                	0x000000018c9ed4e4 bmalloc::Scavenger::threadEntryPoint(bmalloc::Scavenger*) + 16 (Scavenger.cpp:295)
6   JavaScriptCore                	0x000000018c9ee9a0 void* std::__1::__thread_proxy >, void (*)(bmalloc::Scavenger*), bmalloc::Scaveng... + 48 (type_traits:3694)
7   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 5 name:
Thread 5:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   CFNetwork                     	0x0000000181281510 +[__CFN_CoreSchedulingSetRunnable _run:] + 464 (CoreSchedulingSet.mm:1372)
6   Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
7   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 6 name:
Thread 6:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Flutter                       	0x000000010bc2fcd4 fml::MessageLoopDarwin::Run() + 88 (message_loop_darwin.mm:46)
6   Flutter                       	0x000000010bc2f6d8 fml::MessageLoopImpl::DoRun() + 28 (message_loop_impl.cc:96)
7   Flutter                       	0x000000010bc2f6d8 fml::MessageLoop::Run() + 32 (message_loop.cc:49)
8   Flutter                       	0x000000010bc2f6d8 fml::Thread::Thread(std::__1::basic_string, std::__1::allocator > const&)::$_0::operator()() const + 144 (thread.cc:35)
9   Flutter                       	0x000000010bc2f6d8 decltype(std::__1::forward, std::__1::allocator > const&)::$_0>(fp)()) std::__1::__invoke >, fml::Thread::Thread(std::__1::basic_string >, fml::Thread::Thread(std::__1::basic_string, std::__1::allocator > const&)::$_0::operator()() const + 144 (thread.cc:35)
9   Flutter                       	0x000000010bc2f6d8 decltype(std::__1::forward, std::__1::allocator > const&)::$_0>(fp)()) std::__1::__invoke >, fml::Thread::Thread(std::__1::basic_string >, fml::Thread::Thread(std::__1::basic_string, std::__1::allocator > const&)::$_0::operator()() const + 144 (thread.cc:35)
9   Flutter                       	0x000000010bc2f6d8 decltype(std::__1::forward, std::__1::allocator > const&)::$_0>(fp)()) std::__1::__invoke >, fml::Thread::Thread(std::__1::basic_string >, fml::Thread::Thread(std::__1::basic_string&) + 28 (__threading_support:437)
3   Flutter                       	0x000000010bc2adc0 void std::__1::condition_variable::wait(std::__1::unique_lock&, fml::ConcurrentMessageLoop::WorkerMain()::$_1) + 40 (__mutex_base:374)
4   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::WorkerMain() + 80 (concurrent_message_loop.cc:80)
5   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0::operator()() const + 184 (concurrent_message_loop.cc:26)
6   Flutter                       	0x000000010bc2adc0 decltype(std::__1::forward(fp)()) std::__1::__invoke(fm... + 184 (type_traits:4425)
7   Flutter                       	0x000000010bc2adc0 void std::__1::__thread_execute >, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned lon... + 184 (thread:341)
8   Flutter                       	0x000000010bc2adc0 void* std::__1::__thread_proxy >, fml::ConcurrentMessageLoop::ConcurrentMessageLo... + 256 (thread:351)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 10 name:
Thread 10:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019916fddc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:437)
3   Flutter                       	0x000000010bc2adc0 void std::__1::condition_variable::wait(std::__1::unique_lock&, fml::ConcurrentMessageLoop::WorkerMain()::$_1) + 40 (__mutex_base:374)
4   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::WorkerMain() + 80 (concurrent_message_loop.cc:80)
5   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0::operator()() const + 184 (concurrent_message_loop.cc:26)
6   Flutter                       	0x000000010bc2adc0 decltype(std::__1::forward(fp)()) std::__1::__invoke(fm... + 184 (type_traits:4425)
7   Flutter                       	0x000000010bc2adc0 void std::__1::__thread_execute >, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned lon... + 184 (thread:341)
8   Flutter                       	0x000000010bc2adc0 void* std::__1::__thread_proxy >, fml::ConcurrentMessageLoop::ConcurrentMessageLo... + 256 (thread:351)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 11 name:
Thread 11:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019916fddc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:437)
3   Flutter                       	0x000000010bc2adc0 void std::__1::condition_variable::wait(std::__1::unique_lock&, fml::ConcurrentMessageLoop::WorkerMain()::$_1) + 40 (__mutex_base:374)
4   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::WorkerMain() + 80 (concurrent_message_loop.cc:80)
5   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0::operator()() const + 184 (concurrent_message_loop.cc:26)
6   Flutter                       	0x000000010bc2adc0 decltype(std::__1::forward(fp)()) std::__1::__invoke(fm... + 184 (type_traits:4425)
7   Flutter                       	0x000000010bc2adc0 void std::__1::__thread_execute >, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned lon... + 184 (thread:341)
8   Flutter                       	0x000000010bc2adc0 void* std::__1::__thread_proxy >, fml::ConcurrentMessageLoop::ConcurrentMessageLo... + 256 (thread:351)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 12 name:
Thread 12:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019916fddc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:437)
3   Flutter                       	0x000000010bc2adc0 void std::__1::condition_variable::wait(std::__1::unique_lock&, fml::ConcurrentMessageLoop::WorkerMain()::$_1) + 40 (__mutex_base:374)
4   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::WorkerMain() + 80 (concurrent_message_loop.cc:80)
5   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0::operator()() const + 184 (concurrent_message_loop.cc:26)
6   Flutter                       	0x000000010bc2adc0 decltype(std::__1::forward(fp)()) std::__1::__invoke(fm... + 184 (type_traits:4425)
7   Flutter                       	0x000000010bc2adc0 void std::__1::__thread_execute >, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned lon... + 184 (thread:341)
8   Flutter                       	0x000000010bc2adc0 void* std::__1::__thread_proxy >, fml::ConcurrentMessageLoop::ConcurrentMessageLo... + 256 (thread:351)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 13 name:
Thread 13:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019916fddc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:437)
3   Flutter                       	0x000000010bc2adc0 void std::__1::condition_variable::wait(std::__1::unique_lock&, fml::ConcurrentMessageLoop::WorkerMain()::$_1) + 40 (__mutex_base:374)
4   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::WorkerMain() + 80 (concurrent_message_loop.cc:80)
5   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0::operator()() const + 184 (concurrent_message_loop.cc:26)
6   Flutter                       	0x000000010bc2adc0 decltype(std::__1::forward(fp)()) std::__1::__invoke(fm... + 184 (type_traits:4425)
7   Flutter                       	0x000000010bc2adc0 void std::__1::__thread_execute >, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned lon... + 184 (thread:341)
8   Flutter                       	0x000000010bc2adc0 void* std::__1::__thread_proxy >, fml::ConcurrentMessageLoop::ConcurrentMessageLo... + 256 (thread:351)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 14 name:
Thread 14:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019916fddc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:437)
3   Flutter                       	0x000000010bc2adc0 void std::__1::condition_variable::wait(std::__1::unique_lock&, fml::ConcurrentMessageLoop::WorkerMain()::$_1) + 40 (__mutex_base:374)
4   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::WorkerMain() + 80 (concurrent_message_loop.cc:80)
5   Flutter                       	0x000000010bc2adc0 fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned long)::$_0::operator()() const + 184 (concurrent_message_loop.cc:26)
6   Flutter                       	0x000000010bc2adc0 decltype(std::__1::forward(fp)()) std::__1::__invoke(fm... + 184 (type_traits:4425)
7   Flutter                       	0x000000010bc2adc0 void std::__1::__thread_execute >, fml::ConcurrentMessageLoop::ConcurrentMessageLoop(unsigned lon... + 184 (thread:341)
8   Flutter                       	0x000000010bc2adc0 void* std::__1::__thread_proxy >, fml::ConcurrentMessageLoop::ConcurrentMessageLo... + 256 (thread:351)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 15 name:
Thread 15:
0   libsystem_kernel.dylib        	0x00000001b7f42e7c kevent + 8
1   Flutter                       	0x000000010bd6dfa8 dart::bin::EventHandlerImplementation::EventHandlerEntry(unsigned long) + 360 (eventhandler_macos.cc:451)
2   Flutter                       	0x000000010bd9ce24 dart::bin::ThreadStart(void*) + 48 (thread_macos.cc:87)
3   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
4   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 16 name:
Thread 16:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   CoreFoundation                	0x000000018088bb28 CFRunLoopRun + 64 (CFRunLoop.c:3293)
6   CoreMotion                    	0x000000018d8bebc4 CLMotionCore::runMotionThread(void*) + 1204 (CLMotionCore.mm:370)
7   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
8   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 17 name:
Thread 17:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000182029c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6   Foundation                    	0x000000018202a440 -[NSRunLoop(NSRunLoop) run] + 92 (NSRunLoop.m:398)
7   myApp                       	0x00000001068c8788 +[AMapLocationCLMDelegate threadEntryPoint:] + 216
8   Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 18 name:
Thread 18:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000182029c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6   Foundation                    	0x000000018202a440 -[NSRunLoop(NSRunLoop) run] + 92 (NSRunLoop.m:398)
7   myApp                       	0x00000001068b1ad4 +[AMapNetworkOperation networkRequestThreadEntryPoint:] + 216
8   Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 19:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   libc++.1.dylib                	0x000000019916fe78 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock&, std::__1::chrono::time_point > >(std::__1::unique_lock&, long) + 140
5   myApp                       	0x0000000107738ea4 TXCCondition::wait(long) + 60
6   myApp                       	0x000000010771f218 __async_log_thread() + 176
7   myApp                       	0x00000001077205f0 void* std::__1::__thread_proxy >, void (*)()> >(void*) + 44
8   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
9   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 20 name:
Thread 20:
0   libsystem_kernel.dylib        	0x00000001b7f42e7c kevent + 8
1   myApp                       	0x00000001077384e0 txliteav::TXCIOListener::Listen(int) + 136
2   myApp                       	0x0000000107724844 void* std::__1::__thread_proxy >, txliteav::TXCIOLooper::Start()::$_2> >(void*) + 1360
3   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
4   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 21:
0   libsystem_pthread.dylib       	0x00000001f1bfee8c start_wqthread + 0

Thread 22 name:
Thread 22:
0   libsystem_kernel.dylib        	0x00000001b7f41504 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b7f41b9c mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x00000001807f3738 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x00000001807f7a2c __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4   CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   Foundation                    	0x0000000182029c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
6   Foundation                    	0x000000018202a440 -[NSRunLoop(NSRunLoop) run] + 92 (NSRunLoop.m:398)
7   myApp                       	0x0000000104f68b5c +[TABAnimatedCacheManager updateThreadMain:] + 216 (TABAnimatedCacheManager.m:76)
8   Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
9   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
10  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 23:
0   libsystem_pthread.dylib       	0x00000001f1bfee8c start_wqthread + 0

Thread 24 name:
Thread 24 Crashed:
0   libobjc.A.dylib               	0x00000001990c3a58 object_getClass + 48 (objc-object.h:237)
1   Foundation                    	0x0000000182052c3c _NSKeyValueObservationInfoGetObservances + 264 (NSKeyValueObservationInfo.m:792)
2   Foundation                    	0x0000000182054308 NSKeyValueWillChange + 176 (NSKeyValueObserving.m:467)
3   Foundation                    	0x000000018203cf10 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 428 (NSKeyValueObserving.m:2608)
4   Foundation                    	0x000000018205b888 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 824 (NSKeyValueObserving.m:2580)
5   CoreFoundation                	0x000000018084c5b8 -[CFPrefsSource forEachObserver:] + 328 (CFPrefsSource.m:665)
6   CoreFoundation                	0x00000001808e6ee4 -[CFPrefsSource _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 112 (CFPrefsSource.m:814)
7   CoreFoundation                	0x00000001808c1fcc ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke + 440 (CFXPreferences.m:210)
8   CoreFoundation                	0x0000000180817f1c __CFDictionaryApplyFunction_block_invoke + 28 (CFDictionary.c:334)
9   CoreFoundation                	0x00000001808157e4 CFBasicHashApply + 144 (CFBasicHash.c:1029)
10  CoreFoundation                	0x00000001808176f8 CFDictionaryApplyFunction + 328 (CFDictionary.c:333)
11  CoreFoundation                	0x00000001808ad234 _CFPrefsDeliverPendingKVONotificationsGuts + 300 (CFXPreferences.m:69)
12  CoreFoundation                	0x0000000180814784 -[_CFXPreferences _deliverPendingKVONotifications] + 96 (CFXPreferences.m:1146)
13  CoreFoundation                	0x00000001808433d4 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 432 (CFPrefsSearchListSource.m:1731)
14  CoreFoundation                	0x000000018081b3d8 normalizeQuintuplet + 356 (CFPrefsSearchListSource.m:74)
15  CoreFoundation                	0x000000018081445c -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 152 (CFPrefsSearchListSource.m:1600)
16  CoreFoundation                	0x00000001808c5100 -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 128 (CFXPreferences.m:858)
17  CoreFoundation                	0x00000001808488ac _CFPreferencesSetAppValueWithContainerAndConfiguration + 136 (CFXPreferences.m:1970)
18  Foundation                    	0x000000018204bda4 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 84 (NSUserDefaults.m:228)
19  myApp                       	0x0000000106bf9268 +[GTSCommonUtil saveString:forKey:] + 132
20  myApp                       	0x0000000106b390e0 -[GtSdkInfo observeValueForKeyPath:ofObject:change:context:] + 524
21  Foundation                    	0x00000001820430cc NSKeyValueNotifyObserver + 292 (NSKeyValueObserving.m:433)
22  Foundation                    	0x000000018202ed90 NSKeyValueDidChange + 356 (NSKeyValueObserving.m:552)
23  Foundation                    	0x000000018203cfe8 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 644 (NSKeyValueObserving.m:2637)
24  Foundation                    	0x0000000182032d2c -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 72 (NSKeyValueObserving.m:2652)
25  Foundation                    	0x00000001820992fc _NSSetObjectValueAndNotify + 312 (NSKeyValueObserverNotifying.m:111)
26  myApp                       	0x0000000106b240f8 __36-[GtSdkManager runBackgroundEnable:]_block_invoke + 88
27  Foundation                    	0x000000018204e448 __NSThreadPerformPerform + 212 (NSThread.m:1058)
28  CoreFoundation                	0x00000001808a70d0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1972)
29  CoreFoundation                	0x00000001808b7d90 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2016)
30  CoreFoundation                	0x00000001807f2098 __CFRunLoopDoSources0 + 268 (CFRunLoop.c:2053)
31  CoreFoundation                	0x00000001807f78a4 __CFRunLoopRun + 820 (CFRunLoop.c:2951)
32  CoreFoundation                	0x000000018080b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
33  Foundation                    	0x0000000182029c84 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
34  myApp                       	0x0000000106be8150 -[GTSThread main] + 228
35  Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
36  libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
37  libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 25:
0   libsystem_pthread.dylib       	0x00000001f1bfee8c start_wqthread + 0

Thread 26:
0   libsystem_pthread.dylib       	0x00000001f1bfee8c start_wqthread + 0

Thread 27 name:
Thread 27:
0   libsystem_kernel.dylib        	0x00000001b7f41f90 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	0x00000001f1c06254 _pthread_cond_wait + 1228 (pthread_cond.c:636)
2   Foundation                    	0x00000001821c5ff4 -[_NSThreadPerformInfo wait] + 68 (NSThread.m:261)
3   Foundation                    	0x00000001820b8054 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 784 (NSThread.m:1266)
4   Foundation                    	0x00000001820d4a80 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 120 (NSThread.m:1290)
5   myApp                       	0x0000000106b2d5c0 -[NSThread(GTSDK) gtsdk_performWaitingUntilDone:block:] + 176
6   myApp                       	0x0000000106b2d800 +[NSThread(GTSDK) gtsdk_performWaitingUntilDone:block:] + 312
7   myApp                       	0x0000000106b62ad4 -[GXSocketConnectModule sendData:timeout:tag:type:] + 176
8   myApp                       	0x0000000106b627f8 -[GXSocketConnectModule tryAESkey] + 232
9   myApp                       	0x0000000106b3fedc -[GXDatagramChannel socket:didConnectToHost:port:] + 316
10  myApp                       	0x0000000106b46fc8 __28-[GtAsyncSocket didConnect:]_block_invoke_3 + 56
11  libdispatch.dylib             	0x00000001804f5924 _dispatch_call_block_and_release + 32 (init.c:1517)
12  libdispatch.dylib             	0x00000001804f7670 _dispatch_client_callout + 20 (object.m:560)
13  libdispatch.dylib             	0x00000001804fedf4 _dispatch_lane_serial_drain + 672 (inline_internal.h:2601)
14  libdispatch.dylib             	0x00000001804ff968 _dispatch_lane_invoke + 392 (queue.c:3937)
15  libdispatch.dylib             	0x000000018050a1b8 _dispatch_workloop_worker_thread + 656 (queue.c:6727)
16  libsystem_pthread.dylib       	0x00000001f1bff0f4 _pthread_wqthread + 288 (pthread.c:2599)
17  libsystem_pthread.dylib       	0x00000001f1bfee94 start_wqthread + 8

Thread 28:
0   libsystem_pthread.dylib       	0x00000001f1bfee8c start_wqthread + 0

Thread 29 name:
Thread 29:
0   libsystem_kernel.dylib        	0x00000001b7f41ae4 __semwait_signal + 8
1   libsystem_c.dylib             	0x000000018b735f00 nanosleep + 216 (nanosleep.c:104)
2   libsystem_c.dylib             	0x000000018b749f3c sleep + 48 (sleep.c:62)
3   myApp                       	0x00000001069ff180 __48-[BLYLogicManager abortAfterSendingReportIfNeed]_block_invoke + 36
4   libdispatch.dylib             	0x00000001804f5924 _dispatch_call_block_and_release + 32 (init.c:1517)
5   libdispatch.dylib             	0x00000001804f7670 _dispatch_client_callout + 20 (object.m:560)
6   libdispatch.dylib             	0x0000000180508f00 _dispatch_root_queue_drain + 684 (inline_internal.h:2601)
7   libdispatch.dylib             	0x0000000180509608 _dispatch_worker_thread2 + 164 (queue.c:6930)
8   libsystem_pthread.dylib       	0x00000001f1bff0b8 _pthread_wqthread + 228 (pthread.c:2612)
9   libsystem_pthread.dylib       	0x00000001f1bfee94 start_wqthread + 8

Thread 30 name:
Thread 30:
0   libsystem_kernel.dylib        	0x00000001b7f41558 semaphore_timedwait_trap + 8
1   libdispatch.dylib             	0x00000001804f7c7c _dispatch_sema4_timedwait + 64 (lock.c:154)
2   libdispatch.dylib             	0x00000001804f8280 _dispatch_semaphore_wait_slow + 76 (semaphore.c:116)
3   myApp                       	0x00000001069f5690 -[BLYMainRunloopMonitorManager monitorThreadRun] + 176
4   Foundation                    	0x00000001820793fc __NSThread__start__ + 808 (NSThread.m:972)
5   libsystem_pthread.dylib       	0x00000001f1bff9a4 _pthread_start + 148 (pthread.c:891)
6   libsystem_pthread.dylib       	0x00000001f1bfeea0 thread_start + 8

Thread 31:
0   libsystem_pthread.dylib       	0x00000001f1bfee8c start_wqthread + 0

Thread 32:
0   libsystem_pthread.dylib       	0x00000001f1bfee8c start_wqthread + 0


Thread 24 crashed with ARM Thread State (64-bit):
    x0: 0x00000002830e1500   x1: 0x00000001cac30b66   x2: 0x0000000000000000   x3: 0x000000000000000d
    x4: 0x0000000000000006   x5: 0x0000000000000020   x6: 0x00000001820ce078   x7: 0x000000016bdf85b0
    x8: 0x0000f64d63f81500   x9: 0x0000000000000002  x10: 0x0000000101c90e56  x11: 0x003f0001118b1c00
   x12: 0x0000000000000030  x13: 0x00000001118b1ef0  x14: 0x000000004a400000  x15: 0x00000001da811930
   x16: 0x0000f64d63f81500  x17: 0x0000004d63f81500  x18: 0x0000000000000000  x19: 0x00000002830c2940
   x20: 0x000000016bdf8320  x21: 0x0000000000000098  x22: 0x0000000000000013  x23: 0x0000000280de8be0
   x24: 0x000000000000000d  x25: 0x00000001cab84827  x26: 0x000000016bdf8298  x27: 0x00000001da8121a0
   x28: 0x00000002830e1200   fp: 0x000000016bdf8310   lr: 0x0000000182052c3c
    sp: 0x000000016bdf8260   pc: 0x00000001990c3a58 cpsr: 0x20001000
   esr: 0x56000080  Address size fault


Binary Images:
0x104118000 - 0x108aa7fff myApp arm64   /private/var/containers/Bundle/Application/47DE2018-8822-44A3-BA9E-47739353C835/myApp.app/myApp
0x10a544000 - 0x10a59bfff dyld arm64e  <780553c7d39f322a8cb9f4f6de52610d> /usr/lib/dyld
0x10b954000 - 0x10c05bfff Flutter arm64  <6fdbf1fb272b300991a460fb79b34abb> /private/var/containers/Bundle/Application/47DE2018-8822-44A3-BA9E-47739353C835/myApp.app/Frameworks/Flutter.framework/Flutter
0x1804f3000 - 0x180539fff libdispatch.dylib arm64e   /usr/lib/system/libdispatch.dylib
0x1807ec000 - 0x180c3ffff CoreFoundation arm64e   /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x181007000 - 0x1814cbfff CFNetwork arm64e  <23a465f1e97c36c5a30fcefec059f79f> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x182011000 - 0x182317fff Foundation arm64e  <925a43cdeaf2316193783ed87468301d> /System/Library/Frameworks/Foundation.framework/Foundation
0x182c95000 - 0x184520fff UIKitCore arm64e  <920a0ee6d2663058814427a27b23ad62> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x189c20000 - 0x189c49fff AudioSession arm64e   /System/Library/PrivateFrameworks/AudioSession.framework/AudioSession
0x18b731000 - 0x18b7affff libsystem_c.dylib arm64e  <9b299ee5b3793856848b524d82640dbc> /usr/lib/system/libsystem_c.dylib
0x18b808000 - 0x18caf8fff JavaScriptCore arm64e  <8882e299ecd236a1839b41ee2ca83aa6> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
0x18d8ac000 - 0x18dbbbfff CoreMotion arm64e   /System/Library/Frameworks/CoreMotion.framework/CoreMotion
0x1990c0000 - 0x1990f9fff libobjc.A.dylib arm64e  <56a134b6c3d83d91b1fc7bdb75c5903b> /usr/lib/libobjc.A.dylib
0x199166000 - 0x1991c9fff libc++.1.dylib arm64e  <346a1fc1f0b337dbb10209951bb9aa78> /usr/lib/libc++.1.dylib
0x19c3ae000 - 0x19c3b6fff GraphicsServices arm64e   /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1b7f40000 - 0x1b7f73fff libsystem_kernel.dylib arm64e   /usr/lib/system/libsystem_kernel.dylib
0x1f1bfe000 - 0x1f1c09fff libsystem_pthread.dylib arm64e   /usr/lib/system/libsystem_pthread.dylib

EOF
</a>

  

That crash report suggests that you’re crashing here. This is deep within the Objective-C runtime, where it’s doing a pointer authentication on a class pointer. This is usually due to some sort of memory management bug, but as to whether that’s your bug or a bug in the system it’s hard to say. We’re deep in KVO here, and KVO has known race conditions that could cause a crash like this.

To start, I recommend that you test your app thoroughly with the standard memory debugging tools. The goal here is that, if there is a memory mangement bug on your side, this will help flush it you so that you can fix it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I've noticed that AppStorage uses KVO to observe NSUserDefaults. Is it possible that using AppStorage causes writing to NSUserDefaults to no longer be thread-safe, since SwiftUI will get notified on the wrong thread?

After further investigation, I have confirmed the following (submitted as FB12348064):

The AppStorage property wrapper uses KVO to observe UserDefaults. This makes writing to UserDefaults unsafe on non-main threads, even if the AppStorage is not using the same key as is being written. Any write to UserDefaults causes a lookup of all observers. If the AppStorage is deallocated during that lookup, there will be a crash.

The following reliably crashes for me within a few hundred iterations, tested with both Xcode 14.3.1 and 15b1:

import SwiftUI

struct ContentView: View {
    @State var n: Int = 0

    // This song-and-dance is to make sure that AppStorageView is destroyed and recreated.
    // The two views are visually identical to make the output easier to read. One has @AppStorage,
    // the other does not. This causes very fast registering/deregistering from UserDefaults KVO.
    func bodyView() -> AnyView {
        if n % 2 == 0 {
            return AnyView(
                ForEach(0..<10) { _ in
                    AppStorageView(n: n)
                })
        } else {
            return AnyView(
                ForEach(0..<10) { _ in
                    NoAppStorageView(n: n)
                })
        }
    }

    var body: some View {
        bodyView()
            .task {
                // Churn UserDefaults on a background thread.
                Task.detached {
                    while true {
                        UserDefaults.standard.set(Date(), forKey: "randomOtherUserDefaultsKey")
                        await Task.yield()
                    }
                }

                // At the same time, churn the Views to create and destroy AppStorage observations.
                while true {
                    n += 1
                    await Task.yield()
                }
            }
    }
}

// View with @AppStorage observation
struct AppStorageView: View {
    var n: Int

    @AppStorage("appStorageValue") var appStorageValue = false

    var body: some View { LogView(n: n) }
}

// View without @AppStorage observation
struct NoAppStorageView: View {
    var n: Int

    var body: some View { LogView(n: n) }
}

struct LogView: View {
    var n: Int
    var body: some View {
        HStack {
            Text("App Storage Test: \(n)")
            Spacer()
        }
    }
}
UserDefaults.standard setValue forKey crash on iOS 15 only.
 
 
Q