项目中最近集成了百度AI开放平台里面的身份证和营业执照识别功能。今天准备打包上线,但是却提示如下错误:
ERROR ITMS-90087: "Unsupported Architectures. The executable for yimiaozhaopin.app/Frameworks/AipBase.framework contains unsupported architectures '[x86_64, i386]'."
解决办法:
- 步骤1:在xcode中找到包含x86_64, i386的framework。
如图所示序号4这里面的3个framework里面(AipBase.framewok,IdcardQuality.framework,AipOcrSdk.framework)都包含着x86_64, i386。
-
步骤2:用script命令去掉这3个framework里面不支持的x86_64, i386的结构
PS:序号10中粘贴的script命令如下
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