ithzhang 2020-05-19
查看framework支持架构
1.进入到framework目录下
cd /Users/.../xxxFramework.framework
2.输入命令
lipo -info xxxFramework
3.结果
Architectures in the fat file: xxxFramework are: armv7 arm64 不支持模拟器
.a文件也是一样
lipo -info lib.a
结果
Architectures in the fat file: libUPPayPlugin.a are: armv7 arm64 i386 x86_64 支持模拟器
删除架构
lipo -remove i386 xxx -o xxx
lipo -remove x86_64 xxx -o xxx
第二种方式: xcode里添加脚本,打包自动删除模拟器架构
推荐这种方式,可以支持模拟器,只是打包时删除模拟器架构
以下为脚本
`#!/bin/sh
strip_invalid_archs() {
binary="$1"
echo "current binary ${binary}"
archs="$(lipo -info "$binary" | rev | cut -d ‘:‘ -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${ARCHS}" == "$arch" ]]; then
if [ -f "$binary" ]; then
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
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"
strip_invalid_archs "$FRAMEWORK_EXECUTABLE_PATH"
done`