vinceglb / FileKit

Pick and save Files, Medias and Folder for Kotlin Multiplatform / KMP and Compose Multiplatform / CMP
https://vinceglb.github.io/FileKit/
MIT License
561 stars 16 forks source link

IOS: Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError #151

Open Vaxela opened 3 hours ago

Vaxela commented 3 hours ago

Hello i want to use your package, in android work well but in ios i have an error when i try to pick a file :/ kotlinVersion = "1.9.23" filekit = "0.8.7"

i saw other issue with people maybe my kotlin version to old ?

Compliqueted to upgrade using other library not compatible with 2.0...

So i have downgrade to 0.8.1 working on iOS but complicated because we can't have the new update alala ^^

Can you help me ? Thank you :D

Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Property accessor 'pathComponents.<get-pathComponents>' can not be called: No property accessor found for symbol 'platform.Foundation/NSURL.pathComponents.<get-pathComponents>|objc:pathComponents#Accessor[100]' at 0 EasyScan Dev Debug 0x100eae07f kfun:kotlin.Throwable#<init>(kotlin.String?){} + 119 at 1 EasyScan Dev Debug 0x100ea73ef kfun:kotlin.Error#<init>(kotlin.String?){} + 115 at 2 EasyScan Dev Debug 0x100ee0c63 kfun:kotlin.native.internal.IrLinkageError#<init>(kotlin.String?){} + 115 at 3 EasyScan Dev Debug 0x100ee0d1b kfun:kotlin.native.internal#ThrowIrLinkageError(kotlin.String?){}kotlin.Nothing + 163 at 4 EasyScan Dev Debug 0x102609547 kfun:io.github.vinceglb.filekit.core.FileKit.callPhPicker$lambda$8$lambda$7$lambda$6#internal + 559 at 5 EasyScan Dev Debug 0x10260d0ab kfun:io.github.vinceglb.filekit.core.FileKit.$callPhPicker$lambda$8$lambda$7$lambda$6$FUNCTION_REFERENCE$8.invoke#internal + 131 at 6 EasyScan Dev Debug 0x10260d1df kfun:io.github.vinceglb.filekit.core.FileKit.$callPhPicker$lambda$8$lambda$7$lambda$6$FUNCTION_REFERENCE$8.$<bridge-UNNNN>invoke(platform.Foundation.NSURL?;platform.Foundation.NSError?){}#internal + 127 at 7 EasyScan Dev Debug 0x100fe435b kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 115 at 8 EasyScan Dev Debug 0x10260d9cb _46696c654b69743a66696c656b69742d636f72652f55736572732f72756e6e65722f776f726b2f46696c654b69742f46696c654b69742f66696c656b69742d636f72652f7372632f696f734d61696e2f6b6f746c696e2f696f2f6769746875622f76696e6365676c622f66696c656b69742f636f72652f46696c654b69742e696f732e6b74_knbridge61 + 231 at 9 PhotosUI 0x2319e114b <redacted> + 383 at 10 PhotosUI 0x2319e208f <redacted> + 191 at 11 Foundation 0x19f7b7a4f <redacted> + 175 at 12 libdispatch.dylib 0x1066e4a2f _dispatch_call_block_and_release + 31 at 13 libdispatch.dylib 0x1066e671b _dispatch_client_callout + 19 at 14 libdispatch.dylib 0x1066ee5e7 _dispatch_lane_serial_drain + 827 at 15 libdispatch.dylib 0x1066ef35f _dispatch_lane_invoke + 407 at 16 libdispatch.dylib 0x1066fc5ef _dispatch_root_queue_drain_deferred_wlh + 327 at 17 libdispatch.dylib 0x1066fbbff _dispatch_workloop_worker_thread + 579 at 18 libsystem_pthread.dylib 0x2276cfc7b _pthread_wqthread + 287 at 19 libsystem_pthread.dylib 0x2276cc487 start_wqthread + 7

That my base viewmodel with FileKit core : `import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import co.touchlab.kermit.Logger import io.github.vinceglb.filekit.core.FileKit import io.github.vinceglb.filekit.core.PickerMode import io.github.vinceglb.filekit.core.PickerType import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch

class ImportVideoOptionViewModel : ViewModel() { private val _uiState = MutableStateFlow(ImportVideoUiState(false)) val uiState: StateFlow = _uiState

fun pickImage() = executeWithLoading {

    // Pick a file
    val file = FileKit.pickFile(
        type = PickerType.Video,
        title = null,
        mode = PickerMode.Single,
        initialDirectory = null,
        platformSettings = null,
    )

    // Add file to the state
    if (file != null) {
        Logger.d("File picked: $file")
    }
}

private fun executeWithLoading(block: suspend () -> Unit) {
    viewModelScope.launch {
        _uiState.update { it.copy(loading = true) }
        block()
        _uiState.update { it.copy(loading = false) }
    }
}

}`

Vaxela commented 3 hours ago

up i downgrade to 0.8.1 that work but it will be hard to upgrade all the project to 2.0.20 can we find a workaround to have latest update but in older version of kotlin ? ^^