Build Phases —> Click on [+] Button —> New Run Script Phase.
Run Script.
If you are using Xcode 11.4 then please use the below script
- Ruby
Xcode 11.5 or higher then please use the below script
- Ruby
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Build Phases —> Click on [+] Button —> New Run Script Phase.
Run Script.
If you are using Xcode 11.4 then please use the below script
# This script loops through the frameworks embedded in the application
# and removes unused architectures.
find "${TARGET_BUILD_DIR}_${WRAPPER_NAME}" -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"
for arch in $(lipo -archs $FRAMEWORK_EXECUTABLE_PATH); do
if ! printf '%s\n' ${ARCHS[@]} | egrep -q "^$arch$"; then
lipo -remove $arch "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH"
fi
done
done
Xcode 11.5 or higher then please use the below script
APP_PATH="${TARGET_BUILD_DIR}_${WRAPPER_NAME}"
# remove unused architectures from embedded frameworks
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
Was this page helpful?