Hannes
11/28/2021, 8:24 PMnative.cocoa
plugin as described here:
https://kotlinlang.org/docs/native-cocoapods.html#install-the-cocoapods-dependency-manager-and-plugin
I’m just trying the code snipped from the docs to use AFNetworking
inside iOSMain (as described in the docs).
kotlin {
...
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "14.1"
frameworkName = "sharedClient"
podfile = project.file("../iosClient/Podfile")
pod("AFNetworking") {
version = "~> 4.0.1"
}
}
...
}
The problem I am facing right now is that cinteropAFNetworkingIos
fails:
> Task sharedClientcinteropAFNetworkingIos Exception in thread “main” java.lang.Error: /var/folders/n9/5pkml05d7mn3xzdyty8cx5380000gn/T/3707914287112298431.m19: fatal error: could not build module ‘AFNetworking’
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:192)
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:531)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:268)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:76)
at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:38)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:60)
> Task sharedClientcinteropAFNetworkingIos FAILEDI think it is more of a cocoa pods issue on my local machine, but I don’t really know how cocoa pods works exactly under the hood. I think cocoa pods did not download AFNetworking. (In a plain iOS / xcode project (not kotlin multiplatform app) I have used successfully cocoa pods, so I think it is fair to assume the required cocoa pods gems are installed on my machine.) Could anyone please point me in the right direction?
Jeff Lockhart
11/28/2021, 9:25 PMcocoapods-generate
gem installed. This isn't normally required for using CocoaPods with a non-KMM iOS app.
I've seen a similar error before where both cocoapods
and cocoapods-generate
were installed. After uninstalling and reinstalling them both it fixed the issue.
Note, frameworkName
is deprecated. You should replace it with:
framework {
baseName = "sharedClient"
}
Hannes
11/28/2021, 9:56 PMcocoapods-generate
installed.
I also tried to sudo gem uninstall ...
both gems and reinstall them, but didnt help 😞Hannes
11/28/2021, 10:12 PMViacheslav Kormushkin
11/29/2021, 6:32 AMJeff Lockhart
11/29/2021, 6:41 AMtasks.withType(org.jetbrains.kotlin.gradle.tasks.CInteropProcess::class.java) {
settings.compilerOpts("-DNS_FORMAT_ARGUMENT(A)=")
}
Viacheslav Kormushkin
11/29/2021, 6:41 AM