Hello, we have weird crash in our app that mostly seems to happen right after launch. It is quite rare and so far I haven’t been able to reproduce it (the info below comes from Crashlytics).
The main error message I have is this:
failed to demangle witness for associated type 'Property' in conformance 'SwiftUI.StateObject<AppBlock.QuickBlockActivityViewModel>.(unknown context at $18f34e5b8).Box: DynamicPropertyBox' from mangled name '���yxG' - subject type x does not conform to protocol ObservableObject
And here is the stack trace:
Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x7200 __pthread_kill + 8
1 libsystem_pthread.dylib 0x71ac pthread_kill + 268
2 libsystem_c.dylib 0x20ca0 abort + 180
3 libswiftCore.dylib 0x3d7304 swift::fatalError(unsigned int, char const*, ...) + 134
4 libswiftCore.dylib 0x3d7324 swift::warningv(unsigned int, char const*, char*) + 30
5 libswiftCore.dylib 0x3ee678 swift_getAssociatedConformanceWitnessSlowImpl(swift::TargetWitnessTable<swift::InProcess>*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*) + 2078
6 libswiftCore.dylib 0x3ecb9c swift_getAssociatedTypeWitness + 236
7 SwiftUI 0x5b838 OUTLINED_FUNCTION_49 + 640
8 SwiftUI 0xa8d68 OUTLINED_FUNCTION_513 + 16260
9 SwiftUI 0x58244 OUTLINED_FUNCTION_177 + 10892
10 SwiftUI 0x95524 OUTLINED_FUNCTION_1160 + 6632
We are using the view model (QuickBlockActivityViewModel
) in a SwiftUI view that is part of collection view using the new UIHostingConfiguration
from iOS 16.
Our view model is a subclass of view model for older iOS versions that conforms to ObservableObject
and is marked as @MainActor
.
And the view model is used like this:
@StateObject private var viewModel = QuickBlockActivityViewModel()
Internally the view model uses Combine to monitor a couple of states from other parts of the app to modify its properties.