Hey! I am currently struggling to include Pod in `...
# multiplatform
a
Hey! I am currently struggling to include Pod in
iosMain
source set. By this documentation https://kotlinlang.org/docs/reference/native/cocoapods.html#interoperability it should work if I include Pod this way.
Copy code
cocoapodsext {
    summary = Podspec.summary
    homepage = Podspec.homepage
    isStatic = false

    pod(name = "AFNetworking", version = "~> 4.0")
}
When I run
pod install
and try to build project in Xcode it fails with stacktrace:
Copy code
> Task :common:cinteropAFNetworkingIos FAILED
Exception in thread "main" java.lang.Error: /var/folders/tx/90l_s4xn5hz1g4q3bnq_d1400000gn/T/tmp9058487730325846355.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:446)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:228)
	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:46)
	at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:44)
	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19)
	at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:37)
Does
"co.touchlab.native.cocoapods"
support this feature or I have to use
"org.jetbrains.kotlin.native.cocoapods"
to get pods resolved?
r
Can you open an issue on https://github.com/touchlab/KotlinCocoapods? We haven't been pulling in additional pods in our projects so haven't been verifying that that still works.
a
Found out that it actually works, the reason why it didn't work for me at first was - after adding new pod(....) you must run gradle task which regenerates podspec after that you have to run pod install and it all gets resolved in Xcode.
r
Cool! Glad you have it working
r
@russhwolf @aiidziis I am getting the same error when i run
./gradlew build
Copy code
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
        at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:68)
        at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:14)
        at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:507)
        at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:265)
        at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:73)
        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:41)
Any help would be very helpful thanks