12

How to solve this issue.

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'Alladin.app/Frameworks/MercadoPagoSDK.framework/MercadoPagoSDK' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."

ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."

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

here is Screen shot Of errors

  • Possible duplicate of [Submit to App Store issues: Unsupported Architecture x86](https://stackoverflow.com/questions/30547283/submit-to-app-store-issues-unsupported-architecture-x86) – Abhishek Mitra Dec 19 '17 at 08:20

2 Answers2

21

I have fixed issue please follow the steps :-

enter image description here

Build Phases -> plus button -> to create New Run Script Phase

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

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"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp"

case "${TARGET_BUILD_DIR}" in
*"iphonesimulator")
    echo "No need to remove archs"
    ;;
*)
    if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386") ; then
    lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH"
    echo "i386 architecture removed"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
    fi
    if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64") ; then
    lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH"
    echo "x86_64 architecture removed"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
    fi
    ;;
esac

echo "Completed for executable $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

done
CodeChanger
  • 7,953
  • 5
  • 49
  • 80
Dilip Mishra
  • 1,422
  • 13
  • 17
  • Hi, I am facing the same issue with different 3rd party SDK, but the above script is giving me a syntax error near 'then' on line 10 ( "i386") ; then) and then again near esac. Any idea if I am doing something wrong or how to fix the script? – Nikolay DS Apr 20 '18 at 02:04
14

Select Project & open Build Phases Tab.

Under the Tab press plus button to create New Run Script Phase

enter image description here

Add this shell script into run script & you are good to go

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

Hope it helps.

Riajur Rahman
  • 1,976
  • 19
  • 28
  • 9
    Make sure, that the lipo commands are on single line: lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH" – Nikolay DS Apr 26 '18 at 19:05
  • I am getting this if I use the above Script. ERROR ITMS-90085: "No architectures in the binary. Lipo failed to detect any architectures in the bundle executable." – Pradeep Reddy Kypa May 20 '21 at 09:51