1

The app runs fine on the device and simulator and we are able to build an archive without any issues.

The issue is when we want to upload the build to the app store using Xcode 12.5, we get the following error:

enter image description here

Rushabh Shah
  • 396
  • 3
  • 19

2 Answers2

1

I'm using this script to remove unused architectures before submission. And encountered the same problem as you.

So I checked the archive log in Xcode, I fond that some binary are non-fat file. For example error >

fatal error: lipo: input file (/Users/.../MyApp.app/Frameworks/MyFramework.framework/MyFramework) must be a fat file when the -extract option is specified

Looking at the script, because of that error So there is no extraction to create "-merged" file.

At the last step "Replacing original executable with thinned version"

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

It deletes the original binary. !!!

For workaround solution, I just add if condition to check -merged file exists

So I modified the script to this >

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[@]}"

  # Check $FRAMEWORK_EXECUTABLE_PATH-merged (thin file) exists then replace to the original version (fat file)
  if [ -f "$FRAMEWORK_EXECUTABLE_PATH-merged" ]; then
    echo "Replacing original executable with thinned version"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
  fi
  
done

it worked perfectly

0

Solved this error using pod 'Stripe', '19.4.1' So if someone faced this error using Xcode 12.5 or above then use the above pod version.

Rushabh Shah
  • 396
  • 3
  • 19