I’m using ffmpegkit in my iOS app, but when I submit the app to the App Store, I get these errors:
Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/ffmpegkit.framework contains unsupported architectures '[x86_64]'. (ID: 3e35bca7-7b8f-4c2b-bfb2-a27c8ad70c45)Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/libavcodec.framework contains unsupported architectures '[x86_64]'. (ID: fd864260-dae3-4816-bdf3-ca7389374242)Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/libavdevice.framework contains unsupported architectures '[x86_64]'. (ID: fd743847-5d46-4679-8193-51db9445fde1)Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/libavfilter.framework contains unsupported architectures '[x86_64]'. (ID: 54492aff-601e-471a-aef7-25f0549a6364)Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/libavformat.framework contains unsupported architectures '[x86_64]'. (ID: 37bcd80d-7b17-4f95-a20f-577dbb29fc36)Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/libavutil.framework contains unsupported architectures '[x86_64]'. (ID: ead0bd08-84e6-475e-9ce3-9e1c012bafa5)Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/libswresample.framework contains unsupported architectures '[x86_64]'. (ID: fe647420-760c-4404-a039-30c102d7d313)Validation failed
Unsupported Architectures. The executable for MyApp.app/Frameworks/libswscale.framework contains unsupported architectures '[x86_64]'. (ID: 7c8946d8-d75f-455c-b6fd-1bd555abb99f)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/ffmpegkit.framework/ffmpegkit' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 8603e3f0-0235-4f3c-a87f-c263945a11d9)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavcodec.framework/libavcodec' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: f10b4561-0a9c-4aa6-969a-9d3a892be9ec)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavdevice.framework/libavdevice' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 2e6d495a-9131-43da-b6a8-8c23b8d10415)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavfilter.framework/libavfilter' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 40016424-045d-470f-b40a-fba391de2c98)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavformat.framework/libavformat' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: f8cc4367-25bb-4932-bd03-af6729fe7587)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavutil.framework/libavutil' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 495572f9-2dcb-472b-97ea-d16ba6e239a9)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libswresample.framework/libswresample' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 5722d5f0-0f81-422f-8389-e744c73cfd67)Validation failed
Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libswscale.framework/libswscale' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 1e4bf706-5e56-423d-b600-a8298eff698f)Validation failed
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. (ID: 8695bbb6-991f-46cd-9b70-bd86dcef4212)
I add the below code in a runscript:
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)"
EXTRACT_ARCHS=$(lipo -info "$FRAMEWORK_EXECUTABLE_PATH" | rev | cut -d ':' -f1 | rev)
ARCHS_TO_REMOVE=""
for ARCH in $EXTRACT_ARCHS; do
if [ "$ARCH" != "arm64" ]; then
ARCHS_TO_REMOVE="$ARCHS_TO_REMOVE -remove $ARCH"
fi
done
if [ ! -z "$ARCHS_TO_REMOVE" ]; then
lipo $ARCHS_TO_REMOVE "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH" || exit 1
fi
done
I have already tried some suggestion from online but nothing worked.
The encountered error Unsupported Architectures x86 (or x86_64), when submitting to the App Store, happens because some frameworks (for your case, ffmpegkit.framework and so on) include builds for both simulator (x86_64, i386) & device (ARM64, ARMv7). Apple doesn't allow submissions to contain simulator architecture. Based on Daniel & pAkY88's solution, Varrry shared a nice run script to add to the build phase:
echo "Target architectures: $ARCHS"
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"
# remove simulator's archs if location is not simulator's directory
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