input file XXXX must be a fat file when the -remov

2019-08-29 04:08发布

问题:

I am trying to publish our app to testflight/appstore by fastlane and i get these two errors:

  1. fatal error: lipo: input file (==FILEPATH==/CommonCrypto.framework/CommonCrypto) must be a fat file when the -remove option is specified

  2. fatal error: lipo: can't open input file: ==FILEPATH==/Frameworks/CommonCrypto.framework/CommonCrypto (No such file or directory)


Before i got these errors i got lot of "Unsupported Architectures" errors.

ERROR ITMS-90087: "Unsupported Architectures. The executable for ==APPNAME==.app/Frameworks/==FRAMEWORK_NAME==.framework contains unsupported architectures '[x86_64, i386]'."

ERROR ITMS-90087: "Unsupported Architectures. The executable for ==APPNAME==.app/Frameworks/CommonCrypto.framework contains unsupported architectures '[x86_64]'."

So i added this script to the build phase:(From another stack overflow post)

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

    EXTRACTED_ARCHS=()

    for ARCH in $ARCHS
    do
        echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
        lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
        EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    done

    echo "Merging extracted architectures: ${ARCHS}"
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
    rm "${EXTRACTED_ARCHS[@]}"

    echo "Replacing original executable with thinned version"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

Build settings:

  • Architectures: Standard Architectures
  • Base SDK: iOS 11.0
  • Build Active Architectures Only: YES (tried with NO)
  • Supported Platforms: iOS
  • Valid Architectures: arm64, arm7, arm7s

NOTE

The commoncrypto framework is added manualy in embedded Binaries since its only avalible through Carthage. But the project uses mainly cocoapods.


I guess removing the script would solve it. But then its back to the old problem.

But all help is appreciated!