Same here. Did you manage to find the issue?
Post
Replies
Boosts
Views
Activity
It still happens even after clearing any MainActor in its way.
The assert happens in this assembly:
libdispatch.dylib`_dispatch_assert_queue_fail:
...
0x103ae8274 <+68>: add x9, x9, #0xe52 ; "BUG IN CLIENT OF LIBDISPATCH: Assertion failed: "
0x103ae8278 <+72>: stp x9, x8, [sp]
0x103ae827c <+76>: adrp x1, 63
0x103ae8280 <+80>: add x1, x1, #0xe1d ; "%sBlock was %sexpected to execute on queue [%s (%p)]"
0x103ae8284 <+84>: sub x0, x29, #0x18
0x103ae8288 <+88>: bl 0x103b23d60 ; symbol stub for: asprintf
0x103ae828c <+92>: ldur x19, [x29, #-0x18]
0x103ae8290 <+96>: str x19, [sp]
0x103ae8294 <+100>: adrp x0, 63
0x103ae8298 <+104>: add x0, x0, #0xe88 ; "%s"
0x103ae829c <+108>: bl 0x103b1fed4 ; _dispatch_log
0x103ae82a0 <+112>: adrp x8, 101
0x103ae82a4 <+116>: str x19, [x8, #0x1c0]
-> 0x103ae82a8 <+120>: brk #0x1
Is that something I control or is it a bug for Apple?
Thank you, Ziqiao, your example helped me trace the issue after a lot of trial and error.
Regarding appleExerciseTime (and other apple* types), it seemed to me like those types are reserved for the Apple Watch, is that correct?
If so, is there any way for me as a 3rd party app+accessory to make the other activity rings show or affect them in any way without an Apple Watch?
As you suspected, I unfortunately don’t have a reproducible case, as this appears to be a rare race condition (though it has affected approximately 250 of my users).
Here’s an example of the most frequent crash (truncated; full stack trace attached):
Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0xc2d4 __pthread_kill + 8
1 libsystem_pthread.dylib 0x859c pthread_kill + 268
2 libsystem_c.dylib 0x77b08 abort + 128
3 libswiftCore.dylib 0x3ccae4 swift::fatalError(unsigned int, char const*, ...) + 134
4 libswiftCore.dylib 0x3ccb04 swift::warningv(unsigned int, char const*, char*) + 30
5 libswiftCore.dylib 0x3c66cc tryCastFromClassToObjCBridgeable(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 254
6 libswiftCore.dylib 0x3c8408 tryCastToObjectiveCClass(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 88
7 libswiftCore.dylib 0x3c5d30 tryCast(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 992
8 libswiftCore.dylib 0x3c57dc swift_dynamicCast + 208
9 SwiftUI 0x91540 PlatformViewHost.updateNestedHosts(_:colorSchemeChanged:) + 332
10 SwiftUI 0x91110 PlatformViewHost.updateEnvironment(_:viewPhase:) + 272
11 SwiftUI 0x27f148 specialized PlatformViewHost.init(_:host:environment:viewPhase:importer:) + 1288
12 SwiftUI 0x27ec28 specialized PlatformViewHost.__allocating_init(_:host:environment:viewPhase:importer:) + 92
13 SwiftUI 0x27eb88 closure #1 in closure #1 in closure #4 in closure #1 in PlatformViewChild.updateValue() + 504
14 SwiftUI 0x27e984 partial apply for closure #1 in closure #1 in closure #4 in closure #1 in PlatformViewChild.updateValue() + 48
15 SwiftUI 0x27e90c RepresentableContextValues.asCurrent<A>(do:) + 188
16 SwiftUI 0x27e804 closure #1 in closure #4 in closure #1 in PlatformViewChild.updateValue() + 176
17 SwiftUI 0x27e72c partial apply for closure #4 in closure #1 in PlatformViewChild.updateValue() + 128
18 SwiftUICore 0x1640c partial apply for closure #1 in _withObservation<A>(do:) + 48
19 SwiftUICore 0x14148 closure #1 in _withObservation<A>(do:)partial apply + 16
20 SwiftUICore 0x128c8 withUnsafeMutablePointer<A, B, C>(to:_:) + 160
21 SwiftUICore 0x7c08c StatefulRule.withObservation<A>(do:) + 872
22 SwiftUICore 0x7bb8c StatefulRule.withObservation<A>(do:) + 72
...
There’s no reference to any specific code of mine—no clues at all. How would you recommend I tackle this crash?
Full Crash Stacktrace
Also having this problem in OSX Monterey 12.6.