Error while submitting app on Apple Store

235 Views Asked by At

While submitting my app on an Apple store, I am getting the following error.

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

I am using Xcode 11.4. Do I need to update it? I included the following run script in build phases.

# 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

Thanks for your help :).

1

There are 1 best solutions below

0
On

Issue was with 'libstdc++.6.0.9.dylib' library. I was using an old framework that uses this library and because I was running my code on the simulator, therefore, I needed this library at runtime to run my code on a simulator that supports iOS 13. You do not need the support of this lib on the device. After removing the library from Embedded Frameworks, everything works fine now. For a more detailed answer, check this link.

https://github.com/gali8/Tesseract-OCR-iOS/issues/379