Hi has someone been able to use cocoapods with kot...
# ios
s
Hi has someone been able to use cocoapods with kotlin multiplatform? I don’t know what I’m missing, I’m following this doc https://kotlinlang.org/docs/reference/native/cocoapods.html#add-a-dependency-between-a-kotlin-pod-and-xcode-project-with-one-target This is how my
build.gradle.kts
file looks:
Copy code
kotlin {
    android()
    ios()
    cocoapods {
        summary = "Some description for a Kotlin/Native module"
        homepage = "Link to a Kotlin/Native module homepage"
        frameworkName = "SnailCore"
        ios.deploymentTarget = "13.0"
        pod("AFNetworking")
    }
}
When I try to run the iOS app from Xcode I get this error:
Copy code
> Task :SnailCore:cinteropAFNetworkingIosX64 FAILED
Exception in thread "main" java.lang.Error: /var/folders/kq/ztt_vhm14dq4hkd2py7xb_5m0000gn/T/tmp8310314041899312327.m:1:9: fatal error: module 'AFNetworking' not found
	at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
	at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:67)
	at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:13)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:499)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:264)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:72)
	at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19)
	at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:37)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':SnailCore:cinteropAFNetworkingIosX64'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at <https://help.gradle.org>

BUILD FAILED in 3s
2 actionable tasks: 1 executed, 1 up-to-date
Command PhaseScriptExecution failed with a nonzero exit code
I tried deleting pods cache, cleaning build folders and always got the same error Also what does it mean to re-import the project?
d
Have you tried specifying a version for
AFNetworking
?
s
Yes, I got the same error
y
Did you try to open project in idea with kotlin plugin installed before building with xcode?
s
kmm plugin?
I’m using Android Studio
If I remove the AFNetworking code from the kotlin class and build the ios project from android studio it works
y
Could you please create youtrack ticket with the problem, sample for reproduction and describe your environment (like ide, versions, etc)?
s
Sure, where can I access youtrack? I’m new to all this stuff
y
s
Hey @Yaroslav Chernyshev [JB] I managed to get it working, I removed a script in build phases that was the root cause of the error