I got a similar _dispatch_assert_queue_fail crash but the stack trace looks a bit different. I couldn't find the root cause since the stack trace does not show anything related to our code. Do you have any idea?
Interestingly, this crash happens only in iOS 18+.
Note: I attached the full stack
crash.txt
trace
-[UIImageView _mainQ_beginLoadingIfApplicable]
_dispatch_assert_queue_fail
Crashed: com.apple.SwiftUI.AsyncRenderer
EXC_BREAKPOINT 0x000000019c21e3b4
Crashed: com.apple.SwiftUI.AsyncRenderer
0 libdispatch.dylib 0x63b4 _dispatch_assert_queue_fail + 120
1 libdispatch.dylib 0x633c _dispatch_assert_queue_fail + 194
2 UIKitCore 0xb80c4 -[UIImageView _mainQ_beginLoadingIfApplicable] + 76
3 UIKitCore 0xb7fb4 -[UIImageView setHidden:] + 68
4 UIKitCore 0xb7d70 -[UIButtonLegacyVisualProvider _updateImageView] + 372
5 UIKitCore 0xe8830 -[UIButtonLegacyVisualProvider baselineOffsetsAtSize:] + 196
6 UIKitCore 0xe8748 -[UIButton _baselineOffsetsAtSize:] + 52
7 SwiftUI 0x29a48 PlatformViewLayoutEngine.explicitAlignment(_:at:) + 124
8 SwiftUI 0x299c0 protocol witness for LayoutEngine.explicitAlignment(_:at:) in conformance PlatformViewLayoutEngine<A> + 16
9 SwiftUICore 0x136f4 LayoutEngineBox.explicitAlignment(_:at:) + 120
10 SwiftUICore 0x135a4 LayoutProxy.explicitAlignment(_:at:) + 244
11 SwiftUICore 0x129d4 UnaryLayoutEngine.explicitAlignment(_:at:) + 208
12 SwiftUICore 0x13718 protocol witness for LayoutEngine.explicitAlignment(_:at:) in conformance UnaryLayoutEngine<A> + 16
13 SwiftUICore 0x136f4 LayoutEngineBox.explicitAlignment(_:at:) + 120
14 SwiftUICore 0x12130 StackLayout.UnmanagedImplementation.explicitAlignment(_:at:) + 348
15 SwiftUICore 0x307b8 StackLayout.explicitAlignment(_:in:proposal:) + 136
...
57 SwiftUICore 0x1b5000 ViewGraph.updateOutputsAsync(at:) + 560
58 SwiftUICore 0x1b45d4 ViewRendererHost.renderAsync(interval:targetTimestamp:) + 524
59 SwiftUI 0x69d40 UIHostingViewBase.displayLinkTimer(timestamp:targetTimestamp:isAsyncThread:) + 256
60 SwiftUI 0x691d8 DisplayLink.displayLinkTimer(_:) + 280
61 SwiftUI 0x69094 @objc DisplayLink.displayLinkTimer(_:) + 60
62 QuartzCore 0xec1a4 CA::Display::DisplayLinkItem::dispatch_(CA::SignPost::Interval<(CA::SignPost::CAEventCode)835322056>&) + 48
63 QuartzCore 0xebb78 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 884
64 QuartzCore 0xc3b58 display_timer_callback(__CFMachPort*, void*, long, void*) + 456
65 CoreFoundation 0x79b68 __CFMachPortPerform + 176
66 CoreFoundation 0x79aa4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
67 CoreFoundation 0x799c4 __CFRunLoopDoSource1 + 524
68 CoreFoundation 0x762ac __CFRunLoopRun + 2248
69 CoreFoundation 0xc8274 CFRunLoopRunSpecific + 588
70 Foundation 0x29b48 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
71 Foundation 0x25d10 -[NSRunLoop(NSRunLoop) run] + 64
72 SwiftUI 0x375f60 specialized static DisplayLink.asyncThread(arg:) + 792
73 SwiftUI 0x375c30 @objc static DisplayLink.asyncThread(arg:) + 72
74 Foundation 0x115a54 __NSThread__start__ + 724
75 libsystem_pthread.dylib 0x17d0 _pthread_start + 136
76 libsystem_pthread.dylib 0x1480 thread_start + 8
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: