koin icon indicating copy to clipboard operation
koin copied to clipboard

App Crashing in Ios screen Rotation

Open pankaj1920 opened this issue 9 months ago • 3 comments

org.koin.core.error.KoinAppAlreadyStartedException: Trying to run new Koin Application whereas Koin is already started. Use 'KoinContext()' instead of check for any 'startKoin' usage.

In ios whenever i rotate screen app is crashing and getting error but in android app is not crashing on rotate of screen,

Version - koin = "3.5.6" - koin-compose = "1.1.5"

Sample Code

In CommonMain

@Composable fun App(context: Context) {

KoinApplication(application = {
    modules(getSharedModules(context))
}) {
    AppTheme {
        var showContent by remember { mutableStateOf(false) }

        Column(
            Modifier
                .fillMaxSize(),
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Navigator(SplashScreen)

        }
    }
}

}

In SharedModule.kt file

fun getSharedModules(context: Context) = listOf(authModule(),homeModule(), datastoreModule(context), networkModule())

pankaj1920 avatar May 25 '24 18:05 pankaj1920