Thread
#multiplatform
    Charles Prado

    Charles Prado

    1 year ago
    Hello everyone. I'm trying to run the iOS project of my KMM project using CocoaPods. But I always get an error when Xcode tries to run this script
    set -ev
                    REPO_ROOT="$PODS_TARGET_SRCROOT"
                    "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :shared:syncFramework \
                        -Pkotlin.native.cocoapods.target=$KOTLIN_TARGET \
                        -Pkotlin.native.cocoapods.configuration=$CONFIGURATION \
                        -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \
                        -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS" \
                        -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
    The error doesn't say so much, only that:
    Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
    I tried then to run
    ./gradlew -p . :shared:syncFramework
    directly from the terminal and it says that
    Task 'syncFramework' not found in project ':shared'.
    Any ideas how can I solve that?
    Answering my own question here. I solved the problem by updating the FRAMEWORK_SEARCH_PATHS from:
    FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks";
    to:
    FRAMEWORK_SEARCH_PATHS = (
     					"$(inherited)",
     					"\"${PODS_ROOT}/../../shared/build/cocoapods/framework\"",
     				);
    Also, my shared framework reference was wrong in .pbxproj. I updated from:
    7555FFB1242A642300829871 /* shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = shared.framework; path = "../shared/build/xcode-frameworks/shared.framework"; sourceTree = "<group>"; };
    to
    7555FFB1242A642300829871 /* shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = shared.framework; path = ../shared/build/cocoapods/framework/shared.framework; sourceTree = "<group>"; };
    and now it's working 😄