diff --git a/calf-file-picker/src/iosMain/kotlin/com.mohamedrejeb.calf.picker/FilePickerLauncher.ios.kt b/calf-file-picker/src/iosMain/kotlin/com.mohamedrejeb.calf.picker/FilePickerLauncher.ios.kt index 79e687b..f70a803 100644 --- a/calf-file-picker/src/iosMain/kotlin/com.mohamedrejeb.calf.picker/FilePickerLauncher.ios.kt +++ b/calf-file-picker/src/iosMain/kotlin/com.mohamedrejeb.calf.picker/FilePickerLauncher.ios.kt @@ -57,7 +57,7 @@ private fun rememberDocumentPickerLauncher( controller: UIDocumentPickerViewController, didPickDocumentAtURL: NSURL, ) { - onResult(listOf(KmpFile(didPickDocumentAtURL))) + onResult(listOfNotNull(didPickDocumentAtURL.createTempFile()?.let(::KmpFile))) } override fun documentPicker( @@ -66,7 +66,7 @@ private fun rememberDocumentPickerLauncher( ) { val dataList = didPickDocumentsAtURLs.mapNotNull { - (it as? NSURL)?.let(::KmpFile) + (it as? NSURL)?.createTempFile()?.let(::KmpFile) } coroutineScope.launch { withContext(Dispatchers.Main) {