https://kotlinlang.org logo
t

Tristan

12/16/2020, 10:30 PM
Hello, I am trying to use cocoapods by following this documentation: https://kotlinlang.org/docs/reference/native/cocoapods.html But I am encountering the following error. Do you have an idea of what I could be missing? I use the version
1.4.21
, with
Copy code
kotlin {
    android()
    ios()

    cocoapods {
        summary = "summary"
        homepage = "homepage"

        pod("AFNetworking") {
            version = "~> 4.0.1"
        }
    }
// ...
a

Artyom Degtyarev [JB]

12/17/2020, 9:42 AM
Hello, @Tristan! First of all, do you have both cocoapods-related plugins installed as described in the documentation? Also, I’m a bit concerned with
ios.deploymentTarget = "13.5"
- is this also present here?
t

Tristan

12/17/2020, 1:46 PM
Thank you for getting back at me @Artyom Degtyarev [JB] Yes, I did install both of them. (gem install cocoapods and gem install cocoapods-generate). If I remove only the line regarding the pod, it build the project, and I can see a file
shared.podspec
added to my shared module. Adding the line
ios.deploymentTarget = "13.5"
in the
cocoapods { }
scope did not change anything.
So, I investigated you hunch, and you were right. I did install the gems, but on a different environment (because of another project using ruby). I went back to the default ruby environment (no usage of rbenv), and it just worked after restarting the IDE. Thank you very much for your help. Have a great day. [Ticket solved] 🙂
🎉 1
Oh actually… One last thing 😄 Everything build with gradle, but it’s still red here, and I do not have autocompletion. Is it because of Android studio?
And when I compile I get this error
Copy code
> Task :shared:linkDebugTestIosX64 FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
Please try to disable compiler caches and rerun the build. To disable compiler caches, add the following line to the gradle.properties file in the project's root directory:
    
    kotlin.native.cacheKind=none
    
Also, consider filing an issue with full Gradle log here: <https://kotl.in/issue>
The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
Undefined symbols for architecture x86_64:
  "_AFNetworkingReachabilityNotificationStatusItem", referenced from:
      _cocoapods_AFNetworking_AFNetworkingReachabilityNotificationStatusItem_getter_wrapper12 in result.o
ld: symbol(s) not found for architecture x86_64

Execution failed for task ':shared:linkDebugTestIosX64'.
> Compilation finished with errors

* 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.
a

Artyom Degtyarev [JB]

12/17/2020, 2:23 PM
Most probably, this is because
ios()
target shortcut was used. It creates
iosMain
intermediate source set, which does not resolve cocoapods libraries. See https://youtrack.jetbrains.com/issue/KT-41631 for the details.
The linker problem seems interesting, please look at Xcode configuration advices from here, and file a bug if nothing will help.
t

Tristan

12/17/2020, 2:49 PM
I tried and I still get
Copy code
d:linkDebugTestIosX64 FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
Undefined symbols for architecture x86_64:
  "_AFNetworkingReachabilityNotificationStatusItem", referenced from:
      _cocoapods_AFNetworking_AFNetworkingReachabilityNotificationStatusItem_getter_wrapper12 in result.o
ld: symbol(s) not found for architecture x86_64

Execution failed for task ':shared:linkDebugTestIosX64'.
> Compilation finished with errors

* 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.
I really thought the last ticket would have been able to help me 😢 Because it is exactly that, I just used the wizard, and tried to add cocoapods. There is nothing else in the project 😕
6 Views