Closed ln-12 closed 4 years ago
What version of Gradle and also kotlin?
Looks like the coroutines library used is of 1.3.70 and needs to be changed to a 1.4 one.
e: Could not find "/Users/lneumann/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-iosarm64/1.3.8/ab1f410af27e33b328b0e7b3b75875953822e9eb/kotlinx-coroutines-core.klib" in [/Users/lneumann/Projekte/SteigtUm/blue-falcon/examples/KotlinMP/iosApp, /Users/lneumann/.konan/klib, /Users/lneumann/.konan/kotlin-native-prebuilt-macos-1.4.10/klib/common, /Users/lneumann/.konan/kotlin-native-prebuilt-macos-1.4.10/klib/platform/ios_arm64].
Ok, that helped. Now there's another error I can't get rid of. I also had this one in my own project, that's why I wanted to try out the example to see if I'm doing wrong:
> Task :app:compileKotlinIos FAILED
e: /Users/<some path>/blue-falcon/examples/KotlinMP/app/src/iosMain/kotlin/sample/scan.kt: (3, 1): @Throws must have non-empty class list
FAILURE: Build failed with an exception.
If I remove the @Throws
annotation, Xcode builds the project and runs the app. It seems to work fine at first sight, but in the console XCode outputs: Unknown error happened
.
Try kotlin.native.Throws instead?
Nope. Either I put the @Throws
annotation above the method and get @Throws must have non-empty class list
or I leave it out and get Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError. It is considered unexpected and unhandled instead. Program will be terminated.
Sounds very familiar, i recall having a similar issue before and cant remember what i did the fix it. Let me have a think about it.
I figured it out now. I can't call scan()
directly from Swift. Instead, I need to use your MainCompat
approach like shown here. Maybe you could explicitly state that in the documentation? And I also see that @UseExperimental
is deprecated and the NSBluetoothAlwaysUsageDescription
is missing, so I think updating the example would also be a good idea.
Ah, yes that was it. Could you possibly do a PR with the changes?
Thanks
I found that by using the coroutine native-mt dependency we can completely get rid of MainCompat. Everything should be up to date now.
Describe the bug It is not possible to build the KotlinMP example in XCode. Error message:
To Reproduce Steps to reproduce the behavior:
Expected behavior Build completes without errors.
Desktop (please complete the following information):
Smartphone (please complete the following information):