码迷,mamicode.com
首页 > 移动开发 > 详细

iOS13 xcode11打包不支持模拟器架构i386 x86_64

时间:2020-05-19 10:42:57      阅读:359      评论:0      收藏:0      [点我收藏+]

标签:目录   命令   dde   info   tar   oop   -name   efault   删除   

查看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 architectures

strip_invalid_archs() {
binary="$1"
echo "current binary ${binary}"

Get architectures for current file

archs="$(lipo -info "$binary" | rev | cut -d ‘:‘ -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${ARCHS}" == "$arch" ]]; then
if [ -f "$binary" ]; then

Strip non-valid architectures in-place

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}"

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"

strip_invalid_archs "$FRAMEWORK_EXECUTABLE_PATH"
done`

iOS13 xcode11打包不支持模拟器架构i386 x86_64

标签:目录   命令   dde   info   tar   oop   -name   efault   删除   

原文地址:https://www.cnblogs.com/xbios/p/12915385.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!