https://kotlinlang.org logo
#decompose
Title
# decompose
a

Abdul Basit

03/29/2024, 6:48 PM
My app is crashing with these logs attached at the end. Any idea what is happening ? Versions: Decompose:
com.arkivanov.decompose:extensions-compose-jetbrains:2.2.2-compose-experimental
Essentry:
com.arkivanov.essenty:lifecycle:1.3.0
Compose Multiplatform:
1.5.11
I am using regular framework instead of cocopods
Copy code
listOf(
    iosX64(),
    iosArm64(),
    iosSimulatorArm64()
).forEach { iosTarget ->
    iosTarget.binaries.framework {
        baseName = "shared"
        isStatic = true
        export("com.arkivanov.decompose:extensions-compose-jetbrains:2.2.2-compose-experimental")
        export("com.arkivanov.essenty:lifecycle:1.3.0")

    }
}
This is how i am calling my the main:
Copy code
import SwiftUI
import shared

struct ComposeView: UIViewControllerRepresentable {
    private var lifecycleHolder: LifecycleHolder { LifecycleHolder() }

    func makeUIViewController(context: Context) -> UIViewController {
        Main_iosKt.MainiOS(lifecycle: lifecycleHolder.lifecycle)
    }

    func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}

struct ContentView: View {
    var body: some View {
        ComposeView()
                .ignoresSafeArea(.keyboard) // Compose has own keyboard handler
    }
}
Copy code
iosApp`:
    0x102bd46a0 <+0>:   sub    sp, sp, #0x40
    0x102bd46a4 <+4>:   stp    x29, x30, [sp, #0x30]
    0x102bd46a8 <+8>:   add    x29, sp, #0x30
    0x102bd46ac <+12>:  str    x0, [sp, #0x8]
    0x102bd46b0 <+16>:  add    x8, sp, #0x18
    0x102bd46b4 <+20>:  str    x8, [sp, #0x10]
    0x102bd46b8 <+24>:  b      0x102bd46bc               ; <+28> at CoroutineExceptionHandlerImpl.kt
    0x102bd46bc <+28>:  ldr    x9, [sp, #0x8]
    0x102bd46c0 <+32>:  ldr    x8, [sp, #0x10]
    0x102bd46c4 <+36>:  str    x9, [x8, #0x10]!
    0x102bd46c8 <+40>:  str    x8, [sp]
    0x102bd46cc <+44>:  b      0x102bd46d0               ; <+48> at CoroutineExceptionHandlerImpl.kt:25:17
    0x102bd46d0 <+48>:  adrp   x8, 7286
    0x102bd46d4 <+52>:  ldr    x8, [x8, #0x888]
    0x102bd46d8 <+56>:  cbz    x8, 0x102bd46e8           ; <+72> at CoroutineExceptionHandlerImpl.kt
    0x102bd46dc <+60>:  b      0x102bd46e0               ; <+64> at CoroutineExceptionHandlerImpl.kt:25:17
    0x102bd46e0 <+64>:  bl     0x1035d4448               ; (anonymous namespace)::slowPath()
    0x102bd46e4 <+68>:  b      0x102bd46e8               ; <+72> at CoroutineExceptionHandlerImpl.kt
    0x102bd46e8 <+72>:  b      0x102bd46ec               ; <+76> at CoroutineExceptionHandlerImpl.kt:1:1
    0x102bd46ec <+76>:  adrp   x8, 7284
    0x102bd46f0 <+80>:  add    x8, x8, #0x414            ; state_global$kotlinx.coroutines.internal$/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/internal/CoroutineExceptionHandlerImpl.kt
    0x102bd46f4 <+84>:  ldar   w8, [x8]
    0x102bd46f8 <+88>:  subs   w8, w8, #0x2
    0x102bd46fc <+92>:  b.eq   0x102bd4720               ; <+128> at CoroutineExceptionHandlerImpl.kt
    0x102bd4700 <+96>:  b      0x102bd4704               ; <+100> at CoroutineExceptionHandlerImpl.kt:1:1
    0x102bd4704 <+100>: adrp   x0, 7284
    0x102bd4708 <+104>: add    x0, x0, #0x414            ; state_global$kotlinx.coroutines.internal$/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/internal/CoroutineExceptionHandlerImpl.kt
    0x102bd470c <+108>: adrp   x1, 0
    0x102bd4710 <+112>: add    x1, x1, #0x22c            ; kfun:kotlinx.coroutines.internal.$init_global#internal.74 at CoroutineExceptionHandlerImpl.kt
    0x102bd4714 <+116>: bl     0x1035ef8d4               ; CallInitGlobalPossiblyLock
    0x102bd4718 <+120>: b      0x102bd471c               ; <+124> at CoroutineExceptionHandlerImpl.kt:1:1
    0x102bd471c <+124>: b      0x102bd4720               ; <+128> at CoroutineExceptionHandlerImpl.kt
    0x102bd4720 <+128>: ldr    x8, [sp]
    0x102bd4724 <+132>: ldr    x0, [x8]
    0x102bd4728 <+136>: bl     0x1035d6890               ; Kotlin_processUnhandledException
->  0x102bd472c <+140>: b      0x102bd4730               ; <+144> at CoroutineExceptionHandlerImpl.kt:28:2
    0x102bd4730 <+144>: b      0x102bd4734               ; <+148> at CoroutineExceptionHandlerImpl.kt:28:2
    0x102bd4734 <+148>: ldp    x29, x30, [sp, #0x30]
    0x102bd4738 <+152>: add    sp, sp, #0x40
    0x102bd473c <+156>: ret
a

Arkadii Ivanov

03/29/2024, 10:20 PM
Nope, I don't see any issues. Might be a general crash somewhere in coroutines code.
👀 1
a

Abdul Basit

03/30/2024, 8:42 AM
Copy code
//@UIApplicationMain
//class AppDelegate: UIResponder, UIApplicationDelegate {
//    var window: UIWindow?
//    private var lifecycleHolder: LifecycleHolder { LifecycleHolder() }
//
//    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//        window = UIWindow(frame: UIScreen.main.bounds)
//        let mainViewController = Main_iosKt.MainiOS(lifecycle: lifecycleHolder.lifecycle)
//        window?.rootViewController = mainViewController
//        window?.makeKeyAndVisible()
//        return true
//    }
//}



@main
struct iosAppApp: App {
        private var lifecycleHolder: LifecycleHolder { LifecycleHolder() }

    var body: some Scene {
        WindowGroup {
            ContentView(lifecycleRegistyr: lifecycleHolder)
        }
    }
}
Commented the above code and now using App so now it is working fine. I dont have much idea about iOS but now it works fine.
a

Arkadii Ivanov

03/30/2024, 8:46 AM
Thanks for the update!
👍 1
7 Views