解决发布报错“ERROR ITMS-90087: “Unsupported Architectures”

发布应用到Appstore时报错:

App Store Connect Operation Error
ERROR ITMS-90087: "Unsupported Architectures. The executable for XXX.app/Frameworks/XXXX.framework contains unsupported architectures '[x86_ 64]'."

App Store Connect Operation Error
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'XXX.app/Frameworks/
XXXX.framework/XXXX' does not have proper segment alignment. Try rebuilding the app
with the latest Xcode version."

这个错误是因为第三方framework中包含了x86_64, i386,这个是苹果不允许的。

解决办法:

方案1:

先用lipo -info 查看一下framework 包含的平台:

lipo -info XXXX.framework/XXXX

Architectures in the fat file: XXXX.framework/XXXX are: x86_64 armv7 arm64

剔除掉x86_64, i386这两个架构,只保留armv7和arm64。

lipo XXXX.framework/XXXX -thin armv7 -output XXXX_armv7
lipo XXXX.framework/XXXX -thin arm64 -output XXXX_arm64
lipo -create XXXX_armv7 XXXX_arm64 -output XXXX
mv XXXX XXXX.framework/

再用lipo -info 查看一下,这样就得到了去除i386 和 x86_64 的framework 了。

Architectures in the fat file: XXXX.framework/XXXX are: armv7 arm64 

方案2:

 TARGETS->Build Phases->点击加号选择New Run Script Phase,然后复制粘贴下面代码。

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[@]}"
 
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
 
done

猜你喜欢

转载自blog.csdn.net/watson2017/article/details/125743928