Getting a crash on Compose iOS. Has anybody else s...
# compose-ios
t
Getting a crash on Compose iOS. Has anybody else seen this?
Copy code
kfun:androidx.compose.foundation#checkScrollableContainerConstraints(androidx.compose.ui.unit.Constraints;androidx.compose.foundation.gestures.Orientation){} + 28 (CheckScrollableContainerConstraints.kt:0)
kfun:androidx.compose.foundation.lazy.rememberLazyListMeasurePolicy$lambda$2#internal + 204 (LazyList.kt:185)
kfun:androidx.compose.foundation.lazy.$rememberLazyListMeasurePolicy$lambda$2$FUNCTION_REFERENCE$1.invoke#internal + 204 (LazyList.kt:184)
kfun:androidx.compose.foundation.lazy.$rememberLazyListMeasurePolicy$lambda$2$FUNCTION_REFERENCE$1.$<bridge-NNNNB>invoke(androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScope;androidx.comp... + 10356 (LazyList.kt:184)
👍 1
Okay, I think it is close enough to be this: any idea how I can tell when this gets merged into a release? https://github.com/JetBrains/compose-multiplatform/issues/3396
So we just found this crash and we were hoping to ship it. We did not see this crash on any other device in testing, which is frustrating. The only place we see the crash thus far is an iPhone 12 Pro Max running 16.5.1.
Update: I made sure I was using the latest 1.5.0 dev and I get exception in iOS when switching between views that have a LazyColumn in each. Everything works fine on Android. Anybody seen this before?
Copy code
Uncaught Kotlin exception: kotlin.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.
I do hope somebody can help me. Don’t want to rewrite the UI again in SwiftUI if I don’t have to. The illegal state exception above doesn’t make sense since I only have one LazyColumn. I am wondering if the parent UI iewController may be set up in a way to cause this issue? Or perhaps it is related to an issue I have seen mentioned elsewhere where the UI iewController is not being freed, so it might be creating the same view again?
d
Hello! Thanks for report! Can you please check it with version
<https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.5.0-beta01|1.5.0-beta01>
?
t
Untitled
I saw that get released this morning and updated my shared module with that version and re-ran my iOS app on my physical iPad device (it does not crash when I am in the simulator). Switching between two compose uiviewcontrollers (via a SwiftUI picker) causes the same crash. will attach full callstack here as a snippet if curious.
This is what my composable looks like that i wrap directly in a ComposeUIViewController and then use that in my iOS app via a UIHostingController wrapper.
As seen, only one LazyColumn. The referenced cell is just a Card.
Do not need a solution right away. I went ahead and recreated the UI in SwiftUI and it is working well. But I would like to go back to using compose in this view one day (i have not seen any crashes in the other contexts i am using compose for ios). Thank you! It is rather impressive it works as well as it does I think.
142 Views