Tristan

    Tristan

    1 year ago
    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
    kotlin {
        android()
        ios()
    
        cocoapods {
            summary = "summary"
            homepage = "homepage"
    
            pod("AFNetworking") {
                version = "~> 4.0.1"
            }
        }
    // ...
    Artyom Degtyarev [JB]

    Artyom Degtyarev [JB]

    1 year ago
    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?
    Tristan

    Tristan

    1 year ago
    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] 🙂
    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
    > 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.
    Artyom Degtyarev [JB]

    Artyom Degtyarev [JB]

    1 year ago
    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.
    Tristan

    Tristan

    1 year ago
    I tried and I still get
    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 😕