最近在用Flutter開發(fā)的模塊苦酱,在提交上架的時(shí)候渊跋,遇到如下問題了:
原因:
這個(gè)Flutter編譯的framework里面包含了x86_64, i386 [架構(gòu)]瓣颅,在AppStore是不允許的春塌,所有會(huì)在上傳的時(shí)候報(bào)錯(cuò)寝姿,解決辦法就是剔除掉x86_64, i386這兩個(gè)架構(gòu)儡毕;
解決
找了一下資料也切,發(fā)現(xiàn)都是在編譯前,運(yùn)行一段腳本腰湾,試了好多次雷恃,終于有一個(gè)版本是沒問題,可以上傳成功的费坊,以下腳本可以直接復(fù)制使用倒槐;
-
腳本路徑如下圖:
腳本如下
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
以上end,有問題附井,歡迎留言討論讨越;
如果簡(jiǎn)書腳本格式有誤,可以從個(gè)人博客里復(fù)制即可