Inhaltsverzeichnis

German Version

Application Loader Error ITMS-90087

While programming a swift app for iOS, you may experience the following error when trying to upload your app to Apple:

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

Archive a build containing Objective-C libs for Apple

This happens if you include an Objective-C lib in your project. XCode compiles it as x86_64, i386 and ARM bytecode. This is not a problem for the emulator or direct execution on the iPhone. But if you pack your app via Build→Archive and transmit it via XCode→Open Developer Tool→Application Loader to Apple, you get that error above.

Script to delete unecssascary binarys

Solution is adding a script1) to your build process, which deletes the binarys not needed. So they will not appear in the archive and Apple is lucky.

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"
 
if [ ! -f "${FRAMEWORK_EXECUTABLE_PATH}" ]; then
continue
fi
 
if xcrun lipo -info "${FRAMEWORK_EXECUTABLE_PATH}" | grep --silent "Non-fat"; then
echo "Framework non-fat, skipping: $FRAMEWORK_EXECUTABLE_NAME"
continue
fi
 
echo "Thinning framework $FRAMEWORK_EXECUTABLE_NAME"
 
EXTRACTED_ARCHS=()
 
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
xcrun lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
 
echo "Merging extracted architectures: ${ARCHS}"
xcrun 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

How to add your own build script to your build process

The script above can be added to XCode with the click path as follows:2)

Select Project in left panel→Mid Panel click Build Phases+New Run Script Phase

2) Source: http://www.runscriptbuildphase.com/ (September 14th 2017)