Closed juusokos closed 1 year ago
Hey @juusokos. Thank you for putting together an example project! We'll look into the problem.
So, it looks like the crash isn't related to the Crisp SDK at all.
I've noticed that the color property of the AccentColor is set to resolve to tintColor
but only for light mode which is why this crash doesn't happen in dark mode.
If we look at the documentation of UIColor.tintColor, we'll find this:
A color value that resolves at runtime based on the current tint color of the app or trait hierarchy.
You can even reduce the test case to the following which crashes in light mode:
struct ContentView: View {
var body: some View {
Text("Hello World").foregroundColor(.accentColor)
}
}
What happens is an infinite recursion where when accessing Color.accentColor it tries to resolve to UIColor.tintColor which tries to resolve to Color.accentColor which tries to resolve to… (you get the point).
Here's a part of the stack:
In any event, you don't have to wrap the ChatViewController
to use it in Swift but can (and should) use our provided ChatView
for SwiftUI.
The Crisp ChatViewController crashes every time when opened within an app that support Dark/Light mode color theming.
Key to the crash is supporting SwiftUI ligh/dark mode:
Here’s a simple isolated example project you can use that replicates the crash.
https://github.com/juusokos/Crisp-theme-crash