RevenueCat / purchases-kmp

RevenueCat SDK for Kotlin Multiplatform
MIT License
97 stars 3 forks source link

Crash on iOS with specific navigationCompose version (2.8.0-alpha09) #199

Closed MrJohn10 closed 3 weeks ago

MrJohn10 commented 1 month ago

When showing paywall on iOS with org.jetbrains.androidx.navigation:navigation-compose:2.8.0-alpha09 the app crashes.

Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Function 'UIKitViewController' can not be called: No function found for symbol 'androidx.compose.ui.interop/UIKitViewController|UIKitViewController(kotlin.Function0<0:0>;androidx.compose.ui.Modifier;kotlin.Function1<0:0,kotlin.Unit>?;androidx.compose.ui.graphics.Color;kotlin.Function1<0:0,kotlin.Unit>?;kotlin.Function2<0:0,kotlinx.cinterop.CValue<platform.CoreGraphics.CGRect>,kotlin.Unit>?;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§<platform.UIKit.UIViewController>}[0]'
    at 0   Fitpo                               0x1053ea827        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 119 
    at 1   Fitpo                               0x1053e3b0b        kfun:kotlin.Error#<init>(kotlin.String?){} + 115 
    at 2   Fitpo                               0x10541d9bb        kfun:kotlin.native.internal.IrLinkageError#<init>(kotlin.String?){} + 115 
    at 3   Fitpo                               0x10541da73        kfun:kotlin.native.internal#ThrowIrLinkageError(kotlin.String?){}kotlin.Nothing + 163 
    at 4   Fitpo                               0x106648e37        kfun:com.revenuecat.purchases.kmp.ui.revenuecatui#UIKitPaywall(com.revenuecat.purchases.kmp.ui.revenuecatui.PaywallOptions;kotlin.Boolean;androidx.compose.ui.Modifier?;kotlin.Function1<kotlin.Int,kotlin.Unit>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){} + 3011 
    at 5   Fitpo                               0x1066464eb        kfun:com.revenuecat.purchases.kmp.ui.revenuecatui#Paywall(com.revenuecat.purchases.kmp.ui.revenuecatui.PaywallOptions;androidx.compose.runtime.Composer?;kotlin.Int){} + 475 
    at 6   Fitpo                               0x105086c73        kfun:ui.features.dashboard#DashboardRoute(kotlin.Function0<kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){} + 1483 

code to open paywall:

val options = remember { PaywallOptions.Builder { }.build() }
Paywall(options)

purchases versions: purchases-kmp = "1.0.0+13.2.0" purchases-common = "13.2.0"

Changing navigationCompose version to "2.7.0-alpha07" fixes the issue.

JayShortway commented 1 month ago

Thanks for reporting! Looks to be similar to #201. Which version of Compose Multiplatform are you using? And which version of Kotlin?

MrJohn10 commented 1 month ago

compose-plugin = "1.6.11" kotlin = "2.0.0"

JayShortway commented 1 month ago

Thanks, I think this is the same issue as #201, not just related. Compose Navigation 2.8.0-alpha09 depends on Compose 1.7.0, whereas 2.7.0-alpha07 depends on Compose 1.6.10.

There seems to be a binary incompatibility between Compose 1.6.x and 1.7.0. As soon as 1.7.0 is stable, we should be able to support it and fix this issue.

JayShortway commented 3 weeks ago

FYI 1.2.0+13.6.0 was just released with Compose Multiplatform 1.7.0.