iOS13 xcode11打包不支持模擬器架構i386 x86_64


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM