pointfreeco / swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
https://www.pointfree.co/collections/composable-architecture
MIT License
12.61k stars 1.46k forks source link

SwiftUI preview crash #3343

Closed davehpcnt closed 2 months ago

davehpcnt commented 3 months ago

Description

A crash occurs in the SwiftUI preview due to swizzling code. Below is the crash report content. The crash occurs when the "OTHER_LDFLAGS": "-ObjC" setting is applied. Analyzing the crash log, it appears that an infinite recursive call occurs in the viewDidAppear method of UIViewController, leading to a stack overflow. This issue arises as the UIKitNavigation_viewDidAppear method is repeatedly called.

=====


Translated Report (Full Report Below)

Incident Identifier: B7687672-BE8F-46E8-883A-B69B2A9F0D3F CrashReporter Key: FAEF6F72-FE05-501B-B69C-F993621DACB7 Hardware Model: MacBookPro18,2 Process: Affinity [77992] Path: /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/2E7DC482-7082-4D14-9A06-97F189CDCCF2/data/Containers/Bundle/Application/0F6362D3-EE22-445B-8D30-E5E8410602E3/Affinity.app/Affinity Identifier: com.hpcnt.azaraffinity Version: 1.0 (1) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd_sim [69975] Coalition: com.apple.CoreSimulator.SimDevice.2E7DC482-7082-4D14-9A06-97F189CDCCF2 [13991] Responsible Process: SimulatorTrampoline [5585]

Date/Time: 2024-09-03 15:06:23.5813 +0900 Launch Time: 2024-09-03 15:06:10.4109 +0900 OS Version: macOS 14.0 (23A344) Release Type: User Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016cfa3fd0 Exception Codes: 0x0000000000000002, 0x000000016cfa3fd0 VM Region Info: 0x16cfa3fd0 is in 0x1697a0000-0x16cfa4000; bytes after start: 58736592 bytes before end: 47 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL MALLOC_MEDIUM 150000000-158000000 [128.0M] rw-/rwx SM=PRV
GAP OF 0x117a0000 BYTES ---> STACK GUARD 1697a0000-16cfa4000 [ 56.0M] ---/rwx SM=NUL ... for thread 0 Stack 16cfa4000-16d7a0000 [ 8176K] rw-/rwx SM=SHM thread 0 Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [77992]

Triggered by Thread: 0

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 MainView.1.preview-thunk.dylib 0x132601aa0 -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 4 1 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 2 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 493 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 494 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 .. .. .. 498 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 499 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 500 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 501 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 502 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 503 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 504 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 505 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 506 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 507 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 508 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 509 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80 510 MainView.1.preview-thunk.dylib 0x132601aec -[UIViewController(UIKitNavigation) UIKitNavigation_viewDidAppear:] + 80

Thread 1: 0 libsystem_pthread.dylib 0x1044c26dc start_wqthread + 0

Thread 2:: Dispatch queue: com.google.firebase.crashlytics.ios.binary-images 0 libsystem_kernel.dylib 0x10439576c read + 8 1 CoreFoundation 0x1803b2e1c _CFReadBytesFromFile + 348 2 CoreFoundation 0x180454588 CFURLCreateDataAndPropertiesFromResource + 320 3 CoreFoundation 0x180508a74 _CFBundleCopyInfoDictionaryInDirectoryWithVersion + 1480 4 CoreFoundation 0x180509774 _CFBundleRefreshInfoDictionaryAlreadyLocked + 140 5 CoreFoundation 0x18050969c CFBundleGetInfoDictionary + 48 6 CoreFoundation 0x18038469c _CFBundleCreate + 476 7 Foundation 0x180cd6650 -[NSBundle _cfBundle] + 72 8 Foundation 0x180cd8cb4 -[NSBundle infoDictionary] + 12 9 Foundation 0x180cd860c -[NSBundle bundleIdentifier] + 12 10 Affinity 0x1029c2334 FIRCLSBinaryImageRecordLibraryFrameworkInfo + 336 11 Affinity 0x1029c2160 FIRCLSBinaryImageRecordSlice + 248 12 Affinity 0x1029c1d88 FIRCLSProcessBinaryImageChange + 144 13 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 14 libdispatch.dylib 0x180174e3c _dispatch_lane_serial_drain + 960 15 libdispatch.dylib 0x1801759b4 _dispatch_lane_invoke + 388 16 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 17 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 18 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 19 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 3:: Dispatch queue: com.apple.runningboardservices.connection.incoming 0 libsystem_kernel.dylib 0x104394c10 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1043a5da4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x10439ce34 mach_msg_overwrite + 532 3 libsystem_kernel.dylib 0x104394f88 mach_msg + 20 4 libxpc.dylib 0x1800d1b30 _xpc_pipe_mach_msg + 52 5 libxpc.dylib 0x1800d1514 _xpc_send_serializer + 104 6 libxpc.dylib 0x1800d12dc _xpc_pipe_simpleroutine + 136 7 libsystem_trace.dylib 0x180099654 _os_activity_stream_reflect_block_invoke_3 + 36 8 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 9 libdispatch.dylib 0x180170c4c _dispatch_block_invoke_direct + 376 10 libdispatch.dylib 0x180170ac4 dispatch_block_perform + 108 11 libsystem_trace.dylib 0x180098ffc _os_activity_stream_reflect + 680 12 libsystem_trace.dylib 0x1800a72f0 _os_log_impl_stream + 528 13 libsystem_trace.dylib 0x1800a6dc8 _os_log_impl_flatten_and_send + 7432 14 libsystem_trace.dylib 0x1800a50a8 _os_log + 148 15 libsystem_trace.dylib 0x1800a7a48 _os_log_impl + 16 16 RunningBoardServices 0x18367baa8 -[RBSConnection async_didChangeInheritances:completion:] + 544 17 RunningBoardServices 0x18367d528 32-[RBSConnection _handleMessage:]_block_invoke_2 + 164 18 libsystem_trace.dylib 0x180099774 _os_activity_initiate_impl + 56 19 RunningBoardServices 0x18367d160 -[RBSConnection _handleMessage:] + 604 20 RunningBoardServices 0x18367dbac __37-[RBSConnection _lock_setConnection:]_block_invoke + 76 21 libxpc.dylib 0x1800bd7e8 _xpc_connection_call_event_handler + 68 22 libxpc.dylib 0x1800bdba8 _xpc_connection_mach_event + 904 23 libdispatch.dylib 0x18016cdf0 _dispatch_client_callout4 + 16 24 libdispatch.dylib 0x180189cb0 _dispatch_mach_msg_invoke + 620 25 libdispatch.dylib 0x180174bcc _dispatch_lane_serial_drain + 336 26 libdispatch.dylib 0x18018ad70 _dispatch_mach_invoke + 464 27 libdispatch.dylib 0x180174bcc _dispatch_lane_serial_drain + 336 28 libdispatch.dylib 0x1801759b4 _dispatch_lane_invoke + 388 29 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 30 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 31 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 32 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 4: 0 libsystem_pthread.dylib 0x1044c26dc start_wqthread + 0

Thread 5:: Dispatch queue: com.apple.UIKit.KeyboardManagement 0 libsystem_kernel.dylib 0x10439683c ulock_wait + 8 1 libdispatch.dylib 0x18016d630 _dlock_wait + 52 2 libdispatch.dylib 0x18016d3e0 _dispatch_thread_event_wait_slow + 52 3 libdispatch.dylib 0x18017cc5c DISPATCH_WAIT_FOR_QUEUE + 392 4 libdispatch.dylib 0x18017c75c _dispatch_sync_f_slow + 160 5 UIKitCore 0x185169fc0 37-[_UIRemoteKeyboards startConnection]_block_invoke3 + 116 6 CoreFoundation 0x180497750 invoking + 144 7 CoreFoundation 0x180494ab4 -[NSInvocation invoke] + 276 8 Foundation 0x180eac7e0 NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK + 12 9 Foundation 0x180eac418 -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 472 10 Foundation 0x180eb0434 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5 + 184 11 libxpc.dylib 0x1800c92e0 _xpc_connection_reply_callout + 60 12 libxpc.dylib 0x1800bcd30 _xpc_connection_call_reply_async + 76 13 libdispatch.dylib 0x18016cdb4 _dispatch_client_callout3 + 16 14 libdispatch.dylib 0x18018b844 _dispatch_mach_msg_async_reply_invoke + 516 15 libdispatch.dylib 0x180174bcc _dispatch_lane_serial_drain + 336 16 libdispatch.dylib 0x1801759b4 _dispatch_lane_invoke + 388 17 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 18 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 19 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 20 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 6:: com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x104394c10 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1043a5da4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x10439ce34 mach_msg_overwrite + 532 3 libsystem_kernel.dylib 0x104394f88 mach_msg + 20 4 CoreFoundation 0x1803f1754 CFRunLoopServiceMachPort + 156 5 CoreFoundation 0x1803ebe34 CFRunLoopRun + 1148 6 CoreFoundation 0x1803eb5a4 CFRunLoopRunSpecific + 572 7 Foundation 0x180dcd68c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208 8 Foundation 0x180dcd8b0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60 9 UIKitCore 0x185393b88 -[UIEventFetcher threadMain] + 404 10 Foundation 0x180df3e70 NSThreadstart__ + 720 11 libsystem_pthread.dylib 0x1044c74c0 _pthread_start + 104 12 libsystem_pthread.dylib 0x1044c26f0 thread_start + 8

Thread 7:: Dispatch queue: com.apple.UIKit.UIScenePersistenceQueue 0 libsystem_kernel.dylib 0x1043983dc write + 8 1 Foundation 0x180da53a4 _NSWriteToFileDescriptorWithProgress + 196 2 Foundation 0x180da69e4 _NSWriteDataToFileWithExtendedAttributes_block_invoke + 68 3 Foundation 0x180cf2d54 -[NSData(NSData) enumerateByteRangesUsingBlock:] + 112 4 Foundation 0x180da6500 NSWriteDataToFileWithExtendedAttributes + 600 5 UIKitCore 0x185228250 queue_scheduleUpdateAndSaveForPersistedSceneSessions_block_invoke_3 + 460 6 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 7 libdispatch.dylib 0x1801706d4 _dispatch_continuation_pop + 808 8 libdispatch.dylib 0x180183e6c _dispatch_source_invoke + 1616 9 libdispatch.dylib 0x180174bcc _dispatch_lane_serial_drain + 336 10 libdispatch.dylib 0x1801759b4 _dispatch_lane_invoke + 388 11 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 12 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 13 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 14 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 8:: Dispatch queue: com.google.GDTCORUploadCoordinator 0 libsystem_kernel.dylib 0x104394c10 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1043a5da4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x10439ce34 mach_msg_overwrite + 532 3 libsystem_kernel.dylib 0x104394f88 mach_msg + 20 4 libxpc.dylib 0x1800d1b30 _xpc_pipe_mach_msg + 52 5 libxpc.dylib 0x1800d1514 _xpc_send_serializer + 104 6 libxpc.dylib 0x1800d12dc _xpc_pipe_simpleroutine + 136 7 libsystem_trace.dylib 0x180099654 _os_activity_stream_reflect_block_invoke_3 + 36 8 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 9 libdispatch.dylib 0x180170c4c _dispatch_block_invoke_direct + 376 10 libdispatch.dylib 0x180170ac4 dispatch_block_perform + 108 11 libsystem_trace.dylib 0x180098ffc _os_activity_stream_reflect + 680 12 libsystem_trace.dylib 0x1800a72f0 _os_log_impl_stream + 528 13 libsystem_trace.dylib 0x1800a6dc8 _os_log_impl_flatten_and_send + 7432 14 libsystem_trace.dylib 0x1800a50a8 _os_log + 148 15 libsystem_trace.dylib 0x1800a7a48 _os_log_impl + 16 16 Network 0x18754a988 nw_path_evaluator_start + 1012 17 Network 0x18754ac7c nw_path_evaluator_set_update_handler + 180 18 SystemConfiguration 0x180746920 SCNetworkReachabilitySetDispatchQueue + 1028 19 SystemConfiguration 0x180746b60 SCNetworkReachabilitySetDispatchQueue + 116 20 LoginView.1.preview-thunk.dylib 0x1357c5a70 -[GDTCORReachability init] + 240 21 LoginView.1.preview-thunk.dylib 0x1357c57a8 __36+[GDTCORReachability sharedInstance]_block_invoke + 44 22 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 23 libdispatch.dylib 0x18016e530 _dispatch_once_callout + 28 24 LoginView.1.preview-thunk.dylib 0x1357c5754 +[GDTCORReachability sharedInstance] + 88 25 LoginView.1.preview-thunk.dylib 0x1357c56ec +[GDTCORReachability initialize] + 32 26 libobjc.A.dylib 0x18005fc4c CALLINGSOME+initialize_METHOD + 20 27 libobjc.A.dylib 0x18006092c initializeNonMetaClass + 520 28 libobjc.A.dylib 0x1800632b4 initializeAndMaybeRelock(objc_class, objc_object, locker_mixin<lockdebug::lock_mixin>&, bool) + 200 29 libobjc.A.dylib 0x180074f70 lookUpImpOrForward + 620 30 libobjc.A.dylib 0x18005bae0 _objc_msgSend_uncached + 64 31 LoginView.1.preview-thunk.dylib 0x1357ca5d0 -[GDTCORUploadCoordinator uploadConditions] + 36 32 LoginView.1.preview-thunk.dylib 0x1357c9da4 __37-[GDTCORUploadCoordinator startTimer]_block_invoke_2 + 104 33 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 34 libdispatch.dylib 0x1801706d4 _dispatch_continuation_pop + 808 35 libdispatch.dylib 0x180183e6c _dispatch_source_invoke + 1616 36 libdispatch.dylib 0x180174bcc _dispatch_lane_serial_drain + 336 37 libdispatch.dylib 0x1801759b4 _dispatch_lane_invoke + 388 38 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 39 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 40 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 41 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 9:: com.google.firebase.crashlytics.MachExceptionServer 0 libsystem_kernel.dylib 0x104394c10 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1043a5da4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x10439ce34 mach_msg_overwrite + 532 3 libsystem_kernel.dylib 0x104394f88 mach_msg + 20 4 Affinity 0x1029de568 FIRCLSMachExceptionReply + 196 5 Affinity 0x1029de094 FIRCLSMachExceptionServer + 100 6 libsystem_pthread.dylib 0x1044c74c0 _pthread_start + 104 7 libsystem_pthread.dylib 0x1044c26f0 thread_start + 8

Thread 10:: Dispatch queue: com.google.GDTCORFlatFileStorage 0 libsystem_kernel.dylib 0x10439842c rename + 8 1 libsystem_kernel.dylib 0x104398408 rename + 12 2 Foundation 0x180d24520 -[NSFilesystemItemMoveOperation main] + 380 3 Foundation 0x180d9ba8c __NSOPERATION_IS_INVOKING_MAIN + 12 4 Foundation 0x180d97ff8 -[NSOperation start] + 620 5 Foundation 0x180d1c498 -[NSFileManager moveItemAtPath:toPath:error:] + 140 6 Affinity 0x102af63dc __75-[GDTCORFlatFileStorage batchWithEventSelector:batchExpiration:onComplete:]_block_invoke_2 + 744 7 libdispatch.dylib 0x18016b4f4 _dispatch_call_block_and_release + 24 8 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 9 libdispatch.dylib 0x180174e3c _dispatch_lane_serial_drain + 960 10 libdispatch.dylib 0x1801759b4 _dispatch_lane_invoke + 388 11 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 12 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 13 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 14 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 11:: Dispatch queue: com.apple.network.connections 0 libsystem_kernel.dylib 0x104394c10 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1043a5da4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x10439ce34 mach_msg_overwrite + 532 3 libsystem_kernel.dylib 0x104394f88 mach_msg + 20 4 libxpc.dylib 0x1800d1b30 _xpc_pipe_mach_msg + 52 5 libxpc.dylib 0x1800d1514 _xpc_send_serializer + 104 6 libxpc.dylib 0x1800d12dc _xpc_pipe_simpleroutine + 136 7 libsystem_trace.dylib 0x180099654 ___os_activity_stream_reflect_block_invoke_3 + 36 8 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 9 libdispatch.dylib 0x180170c4c _dispatch_block_invoke_direct + 376 10 libdispatch.dylib 0x180170ac4 dispatch_block_perform + 108 11 libsystem_trace.dylib 0x180098ffc _os_activity_stream_reflect + 680 12 libsystem_trace.dylib 0x1800a72f0 _os_log_impl_stream + 528 13 libsystem_trace.dylib 0x1800a6dc8 _os_log_impl_flatten_and_send + 7432 14 libsystem_trace.dylib 0x1800a50a8 _os_log + 148 15 libsystem_trace.dylib 0x1800a7a48 _os_log_impl + 16 16 libboringssl.dylib 0x1869a9940 boringssl_session_handshake_incomplete + 828 17 libboringssl.dylib 0x1869b22e8 nw_protocol_boringssl_handshake_negotiate + 116 18 libboringssl.dylib 0x1869b3270 nw_boringssl_read + 3124 19 libboringssl.dylib 0x1869b378c nw_protocol_boringssl_input_available + 320 20 Network 0x187508abc nw_socket_update_input_source(void*) + 184 21 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 22 libdispatch.dylib 0x1801706d4 _dispatch_continuation_pop + 808 23 libdispatch.dylib 0x180183e6c _dispatch_source_invoke + 1616 24 libdispatch.dylib 0x18017684c _dispatch_workloop_invoke + 784 25 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 26 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 27 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 28 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 12:: Dispatch queue: com.apple.root.default-qos.overcommit 0 libsystem_kernel.dylib 0x104394c10 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1043a5da4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x10439ce34 mach_msg_overwrite + 532 3 libsystem_kernel.dylib 0x104394f88 mach_msg + 20 4 libxpc.dylib 0x1800d1b30 _xpc_pipe_mach_msg + 52 5 libxpc.dylib 0x1800d1514 _xpc_send_serializer + 104 6 libxpc.dylib 0x1800d12dc _xpc_pipe_simpleroutine + 136 7 libsystem_trace.dylib 0x180099654 _os_activity_stream_reflect_block_invoke_3 + 36 8 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 9 libdispatch.dylib 0x180170c4c _dispatch_block_invoke_direct + 376 10 libdispatch.dylib 0x180170ac4 dispatch_block_perform + 108 11 libsystem_trace.dylib 0x180098ffc _os_activity_stream_reflect + 680 12 libsystem_trace.dylib 0x1800a72f0 _os_log_impl_stream + 528 13 libsystem_trace.dylib 0x1800a6dc8 _os_log_impl_flatten_and_send + 7432 14 libsystem_trace.dylib 0x1800a50a8 _os_log + 148 15 libsystem_trace.dylib 0x1800a7a48 _os_log_impl + 16 16 libsystem_containermanager.dylib 0x1896e91e4 container_xpc_create_connection_block_invoke + 244 17 libxpc.dylib 0x1800bd7e8 _xpc_connection_call_event_handler + 68 18 libxpc.dylib 0x1800bdbc4 _xpc_connection_mach_event + 932 19 libdispatch.dylib 0x18016cdf0 _dispatch_client_callout4 + 16 20 libdispatch.dylib 0x18018db94 _dispatch_mach_cancel_invoke + 72 21 libdispatch.dylib 0x18018af6c _dispatch_mach_invoke + 972 22 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 23 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 24 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 25 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 13:: Dispatch queue: com.google.GDTCORUploadCoordinator 0 libsystem_kernel.dylib 0x104394c10 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1043a5da4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x10439ce34 mach_msg_overwrite + 532 3 libsystem_kernel.dylib 0x104394f88 mach_msg + 20 4 libxpc.dylib 0x1800d1b30 _xpc_pipe_mach_msg + 52 5 libxpc.dylib 0x1800d1514 _xpc_send_serializer + 104 6 libxpc.dylib 0x1800d12dc _xpc_pipe_simpleroutine + 136 7 libsystem_trace.dylib 0x180099654 _os_activity_stream_reflect_block_invoke_3 + 36 8 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 9 libdispatch.dylib 0x180170c4c _dispatch_block_invoke_direct + 376 10 libdispatch.dylib 0x180170ac4 dispatch_block_perform + 108 11 libsystem_trace.dylib 0x180098ffc _os_activity_stream_reflect + 680 12 libsystem_trace.dylib 0x1800a72f0 _os_log_impl_stream + 528 13 libsystem_trace.dylib 0x1800a6dc8 _os_log_impl_flatten_and_send + 7432 14 libsystem_trace.dylib 0x1800a50a8 _os_log + 148 15 libsystem_trace.dylib 0x1800a7a48 _os_log_impl + 16 16 Network 0x18754a988 nw_path_evaluator_start + 1012 17 Network 0x18754ac7c nw_path_evaluator_set_update_handler + 180 18 SystemConfiguration 0x180746920 SCNetworkReachabilitySetDispatchQueue + 1028 19 SystemConfiguration 0x180746b60 SCNetworkReachabilitySetDispatchQueue + 116 20 MainView.1.preview-thunk.dylib 0x132011ec0 -[GDTCORReachability init] + 240 21 MainView.1.preview-thunk.dylib 0x132011bf8 __36+[GDTCORReachability sharedInstance]_block_invoke + 44 22 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 23 libdispatch.dylib 0x18016e530 _dispatch_once_callout + 28 24 MainView.1.preview-thunk.dylib 0x132011ba4 +[GDTCORReachability sharedInstance] + 88 25 MainView.1.preview-thunk.dylib 0x132011b3c +[GDTCORReachability initialize] + 32 26 libobjc.A.dylib 0x18005fc4c CALLINGSOME+initialize_METHOD + 20 27 libobjc.A.dylib 0x18006092c initializeNonMetaClass + 520 28 libobjc.A.dylib 0x1800632b4 initializeAndMaybeRelock(objc_class, objc_object, locker_mixin<lockdebug::lock_mixin>&, bool) + 200 29 libobjc.A.dylib 0x180074f70 lookUpImpOrForward + 620 30 libobjc.A.dylib 0x18005bae0 _objc_msgSend_uncached + 64 31 MainView.1.preview-thunk.dylib 0x132016a20 -[GDTCORUploadCoordinator uploadConditions] + 36 32 MainView.1.preview-thunk.dylib 0x1320161f4 __37-[GDTCORUploadCoordinator startTimer]_block_invoke_2 + 104 33 libdispatch.dylib 0x18016cd3c _dispatch_client_callout + 16 34 libdispatch.dylib 0x1801706d4 _dispatch_continuation_pop + 808 35 libdispatch.dylib 0x180183e6c _dispatch_source_invoke + 1616 36 libdispatch.dylib 0x180174bcc _dispatch_lane_serial_drain + 336 37 libdispatch.dylib 0x1801759b4 _dispatch_lane_invoke + 388 38 libdispatch.dylib 0x180180d40 _dispatch_root_queue_drain_deferred_wlh + 276 39 libdispatch.dylib 0x18018038c _dispatch_workloop_worker_thread + 448 40 libsystem_pthread.dylib 0x1044c3924 _pthread_wqthread + 284 41 libsystem_pthread.dylib 0x1044c26e4 start_wqthread + 8

Thread 14: 0 libsystem_pthread.dylib 0x1044c26dc start_wqthread + 0

Thread 0 crashed with ARM Thread State (64-bit): x0: 0x000000010883f000 x1: 0x00000001031c887b x2: 0x0000000000000001 x3: 0x000000010883f000 x4: 0x00000001c5c7b73c x5: 0x000000000000003e x6: 0x0000000004020100 x7: 0x0001000100000000 x8: 0x0000000000000001 x9: 0x00000001031c887b x10: 0x0000000107081a00 x11: 0x00000000000000ff x12: 0x000000000000007b x13: 0x00000001070821a0 x14: 0x090000010883b2ad x15: 0x000000010883b2a8 x16: 0x000000010883b2a8 x17: 0x0000000132601a9c x18: 0x0000000000000000 x19: 0x00000001c53c1ea0 x20: 0x000000010883f000 x21: 0x00000001f8231768 x22: 0x0000000000000001 x23: 0x0000000000000001 x24: 0x0000000000000000 x25: 0x0000600000c043c0 x26: 0x00000001f1854000 x27: 0x0000000002090881 x28: 0x00000001f1854000 fp: 0x000000016cfa4140 lr: 0x0000000132601aec sp: 0x000000016cfa3e90 pc: 0x0000000132601aa0 cpsr: 0x60001000 far: 0x000000016cfa3fd0 esr: 0x92000047 (Data Abort) byte write Translation fault

Binary Images: 0x10450c000 - 0x10459ffff dyld () /usr/lib/dyld 0x135360000 - 0x135f0ffff LoginView.1.preview-thunk.dylib () <5641c4e7-3899-3d71-91b1-79a6fecbe699> /Users/USER/Library/Developer/Xcode/DerivedData/Affinity-dwhatbwusysfovgvmrlwiaynzcxw/Build/Intermediates.noindex/Previews/Affinity/Intermediates.noindex/Affinity.build/Debug-iphonesimulator/Affinity.build/Objects-normal/arm64/LoginView.1.preview-thunk.dylib 0x131bb0000 - 0x13275bfff MainView.1.preview-thunk.dylib () /Users/USER/Library/Developer/Xcode/DerivedData/Affinity-dwhatbwusysfovgvmrlwiaynzcxw/Build/Intermediates.noindex/Previews/Affinity/Intermediates.noindex/Affinity.build/Debug-iphonesimulator/Affinity.build/Objects-normal/arm64/MainView.1.preview-thunk.dylib 0x1047a8000 - 0x1047b3fff libobjc-trampolines.dylib () <67a0ff9d-452e-3fe0-8b6e-ea95cf3a8b07> /Volumes/VOLUME//libobjc-trampolines.dylib 0x105600000 - 0x1057bbfff Alamofire (1.0) <8550e8d1-0760-356e-9c8b-13961e4d786f> /Users/USER/Library/Developer/Xcode/DerivedData/Affinity-dwhatbwusysfovgvmrlwiaynzcxw/Build/Intermediates.noindex/Previews/Affinity/Products/Debug-iphonesimulator/Alamofire.framework/Alamofire 0x106680000 - 0x106babfff org.webrtc.WebRTC (1.0) <4c4c44ee-5555-3144-a145-483be05975bf> /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/2E7DC482-7082-4D14-9A06-97F189CDCCF2/data/Containers/Bundle/Application/0F6362D3-EE22-445B-8D30-E5E8410602E3/Affinity.app/Frameworks/WebRTC.framework/WebRTC 0x1044a0000 - 0x1044a7fff libsystem_platform.dylib () /usr/lib/system/libsystem_platform.dylib 0x104394000 - 0x1043cbfff libsystem_kernel.dylib () <642a38ac-927b-39b2-9654-365bc3f3c14e> /usr/lib/system/libsystem_kernel.dylib 0x1044c0000 - 0x1044cffff libsystem_pthread.dylib () /usr/lib/system/libsystem_pthread.dylib 0x1052b8000 - 0x1052d3fff com.apple.mlcompiler.services (95) <25f3a985-ceb4-3de6-be6b-d78298983f92> /Volumes/VOLUME//MLCompilerServices.framework/MLCompilerServices 0x102660000 - 0x10324ffff com.hpcnt.azaraffinity (1.0) <77381c72-e010-35a4-91dc-999e3958d0c0> /Users/USER/Library/Developer/Xcode/UserData/Previews/Simulator Devices/2E7DC482-7082-4D14-9A06-97F189CDCCF2/data/Containers/Bundle/Application/0F6362D3-EE22-445B-8D30-E5E8410602E3/Affinity.app/Affinity 0x10441c000 - 0x104463fff dyld_sim () <45b5018b-7ae1-3c95-86a5-d89fd6cb36ae> /Volumes/VOLUME//dyld_sim 0x0 - 0xffffffffffffffff ??? () <00000000-0000-0000-0000-000000000000> ??? 0x1c4371000 - 0x1c5e0bfff com.apple.SwiftUI (5.2.12.1.100) /Volumes/VOLUME//SwiftUI.framework/SwiftUI 0x180364000 - 0x180717fff com.apple.CoreFoundation (6.9) /Volumes/VOLUME//CoreFoundation.framework/CoreFoundation 0x180797000 - 0x18123dfff com.apple.Foundation (6.9) <03b66a9f-be07-39ef-812d-ea7d8b87f7eb> /Volumes/VOLUME//Foundation.framework/Foundation 0x180169000 - 0x1801aefff libdispatch.dylib () <9505af94-04cc-3037-9759-6c4dc09943ad> /Volumes/VOLUME//libdispatch.dylib 0x1800ae000 - 0x1800e8fff libxpc.dylib () /Volumes/VOLUME//libxpc.dylib 0x180095000 - 0x1800adfff libsystem_trace.dylib () <61444861-67a8-3db3-95f0-6dc2809d4000> /Volumes/VOLUME//libsystem_trace.dylib 0x18365e000 - 0x1836b2fff com.apple.RunningBoardServices (1.0) <5c4d05e7-c61e-3344-b70c-2575943389e6> /Volumes/VOLUME//RunningBoardServices.framework/RunningBoardServices 0x18471f000 - 0x186085fff com.apple.UIKitCore (1.0) /Volumes/VOLUME//UIKitCore.framework/UIKitCore 0x186ea6000 - 0x187920fff com.apple.Network (1.0) <91af89e9-6e5d-317f-8f03-9b50fdded24e> /Volumes/VOLUME//Network.framework/Network 0x180718000 - 0x180796ffb com.apple.SystemConfiguration (1.21) /Volumes/VOLUME//SystemConfiguration.framework/SystemConfiguration 0x180058000 - 0x180094fb8 libobjc.A.dylib () /Volumes/VOLUME//libobjc.A.dylib 0x1800e9000 - 0x1800ecffc libsystem_blocks.dylib () <707514df-5450-3c29-8ece-826436ad1af9> /Volumes/VOLUME//libsystem_blocks.dylib 0x1869a4000 - 0x186a64ff7 libboringssl.dylib () /Volumes/VOLUME//libboringssl.dylib 0x1896df000 - 0x189705ff7 libsystem_containermanager.dylib () <2f4dd110-f4e4-3f29-a910-5028279ffc95> /Volumes/VOLUME/*/libsystem_containermanager.dylib

EOF

Checklist

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

The Composable Architecture version information

No response

Destination operating system

No response

Xcode version information

No response

Swift Compiler version information

No response

mbrandonw commented 2 months ago

Hi @davehpcnt, can you please provide a project that reproduces the problem?

davehpcnt commented 2 months ago

I configured it simply like this. I applied Google login and added the ObjC flag.

import ComposableArchitecture
import SwiftUI

struct LoginView: View {
    let store: StoreOf<Login>

    var body: some View {
        VStack {
            Button("Apple Login") {
                store.send(.login(.apple))
            }
            Spacer()
                .frame(height: 30)
            Button("Google Login") {
                store.send(.login(.google))
            }
        }
    }
}

#Preview {
    LoginView(
        store: Store(initialState: Login.State()) {
            Login()
        }
    )
}
import AffinityAPI
import ComposableArchitecture
import SwiftUI

@Reducer
struct Login {
    @ObservableState
    struct State {
        // Your state here
    }

    enum Action {
        case login(LoginType)
        case loginCompleted(Result<DTOLoginResponse, Error>)
    }

    @Dependency(\.loginManager)
    var loginManager

    var body: some ReducerOf<Self> {
        Reduce { _, action in
            switch action {
            case let .login(loginType):
                return .run { send in
                    let result = try await loginManager.signIn(with: loginType)
                    await send(.loginCompleted(result))
                }

            case let .loginCompleted(.success(loginResponse)):
                print(loginResponse)
                return .none

            case let .loginCompleted(.failure(error)):
                return .none
            }
        }
    }
}
mbrandonw commented 2 months ago

Hi @davehpcnt, can you please provide a full, compiling project that demonstrates the behavior? I have created a fresh TCA project and enabled the -ObjC flag, and I do not see any issue with my previews.

Since it is not clear this is an issue with the library I am going to convert it to a discussion for now. Please feel free to continue the conversation over there.