Hello, I am trying to use the <CocoaMQTT> Pod in t...
# ios
a
Hello, I am trying to use the CocoaMQTT Pod in the iOS Part of my App . I have created a minimal sample that exhibits the issue here: https://github.com/below/PodSample When you try to build the app for iOS, there is an error:
Copy code
> Task :shared:cinteropCocoaMQTTIosSimulatorArm64
Exception in thread "main" java.lang.Error: /Users/below/dev/kmp/PodSample/shared/build/cocoapods/synthetic/IOS/build/Release-iphonesimulator/CocoaMQTT/CocoaMQTT.framework/Headers/CocoaMQTT-Swift.h:560:58: error: cannot find protocol declaration for 'MGCDAsyncSocketDelegate'
Any idea what could be wrong? Thank you!
k
does the library have ObjC headers? Kotlin doesn't have Swift interop
a
Thank you @Konstantin Tskhovrebov. yes, it does. I have also tried it with a native Objective-C app, just to be sure
m
@Konstantin Tskhovrebov for me it looks like an issue with processing of spec.dependencies. Error states that
MGCDAsyncSocketDelegate
is missing, which is part of
MqttCocoaAsyncSocket
and this is defined as spec.dependency of the library. If I define
MqttCocoaAsyncSocket
to be imported explicitly via
build.gradle.kts
file, for some reason is
cinterpro
task for
MqttCocoaAsyncSocket
called always after the main lib
CocoaMQTT
. So I am also still getting the error …
k
@a-dd cc
a
@Alexander von Below there are
@import
directive usages in a generated Obj-C header. It is supported only since 1.8.20-RC and it requires additional cinterop flag for now:
Copy code
pod("CocoaMQTT") {
    extraOpts = listOf("-compiler-option", "-fmodules")
}
More details in https://youtrack.jetbrains.com/issue/KT-39120/Cinterop-tool-doesnt-support-the-fmodules-compiler-argument
m
Thank you very much, @a-dd