解决ios打包出现解决Unsupported Architecture~

解决ios打包出现解决Unsupported Architecture~

打包用Application Loader 上传ipa时候无法上传,出现了以下错误:

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

ERROR ITMS-90087: "Unsupported Architectures. The executable for ECEJ.app/Frameworks/XXXUIFramework.framework contains unsupported architectures '[x86_64, i386]'."
查了一下,如果archive的时候没有选iOS devices而是模拟器,会出现这个错误提示。另一种情况就是我项目中的:用到了一些其它的结构包含x86_64, i386的framework。

可以在终端使用
$ lipo -info workspacePath/XXX.framework/XXX
命令来检查一下frame。
解决方法是生成binary的时候使用一段script来去掉那些不支持的结构。

解决方法
  1. 在Xcode中选择项目->targets->Build Phases, 找到Embed Framework。
  2. 然后在Xcode的菜单栏Editor->Add Build Phase->Add Run Scrip Build Phase。
  3. 于是在Embed Framework下面会出现Run Script。
    Shell填入:/bin/sh
    下面输入这段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
然后重新archive即可。

你可能感兴趣的:(解决ios打包出现解决Unsupported Architecture~)