JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.88k stars 1.15k forks source link

[iOS] IrLinkageError error: Function 'ComposeUIViewController' can not be called #3860

Open OlgaMatsyk opened 10 months ago

OlgaMatsyk commented 10 months ago

Describe the bug Error occurs in runtime on attempt to navigate to view controller that contains compose view Affected platforms Select one of the platforms below:

Versions

To Reproduce Steps and/or the code snippet to reproduce the behavior:

  1. Create compose multiplatform sharable view
  2. Create wrapper for view on iOS , add view to view controller
  3. See error: Application crashes with error log: Function 'ComposeUIViewController' can not be called

Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Function 'ComposeUIViewController' can not be called: No function found for symbol 'androidx.compose.ui.window/ComposeUIViewController|-6677963148346598382[0]' at 0 MPJShared 0x116b3da7b kfun:kotlin.Throwable#(kotlin.String?){} + 123 at 1 MPJShared 0x116b365f7 kfun:kotlin.Error#(kotlin.String?){} + 119 at 2 MPJShared 0x116b7e5a3 kfun:kotlin.native.internal.IrLinkageError#(kotlin.String?){} + 119 at 3 MPJShared 0x116b7e667 kfun:kotlin.native.internal#ThrowIrLinkageError(kotlin.String?){}kotlin.Nothing + 175 at 4 MPJShared 0x1161f6e8b kfun:mpj#MainViewController(mpj.ui.screens.home.VolumeControlModel;kotlin.String;kotlin.String;kotlin.String;kotlin.Function0;kotlin.Function2<kotlin.Int,kotlin.Int,kotlin.Unit>;kotlin.Function1<kotlin.Boolean,kotlin.Unit>){}platform.UIKit.UIViewController + 431 at 5 MPJShared 0x11633b96b objc2kotlin_kfun:mpj#MainViewController(mpj.ui.screens.home.VolumeControlModel;kotlin.String;kotlin.String;kotlin.String;kotlin.Function0;kotlin.Function2<kotlin.Int,kotlin.Int,kotlin.Unit>;kotlin.Function1<kotlin.Boolean,kotlin.Unit>){}platform.UIKit.UIViewController + 379 ... at 8 SwiftUI 0x18840fc87 + 291 ... at 102 CoreFoundation 0x180b83173 CFRunLoopRunSpecific + 571 at 103 GraphicsServices 0x1a169e987 GSEventRunModal + 159 at 104 UIKitCore 0x183385a87 + 1079 at 105 UIKitCore 0x18311ef77 UIApplicationMain + 335 at 106 Pediatric 0x102f28463 main + 347 at 107 dyld 0x105a904cf 0x0 + 4389930191 dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

Expected behavior Application should run without crash

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

dima-avdeev-jb commented 10 months ago

Thanks for Issue. Can you please provide a minimal reproducible sample of your Issue?

DevSrSouza commented 10 months ago

I had the same issue here

DevSrSouza commented 10 months ago

My setup consisnt in Multimodule KMP project, the umbrella module does not contain any compose code or the Compose plugin, it export() a Kotlin module that has custom a function to create the ComposeUIViewController to iOS.

The Xcode setup is with build phases, isStatic is not set as true

dima-avdeev-jb commented 10 months ago

@DevSrSouza Hello! Maybe you can provide a minimal reproducible sample with this Issue?

DevSrSouza commented 10 months ago

Fix it here! Just by adding the Compose Gradle Plugin at the umbrella module!

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.