蘋果已經開始抱怨,如果應用程序分發中包含模擬器架構。
如何解決上述錯誤?
解決方案:
添加以下代碼項目目標的運行腳本,這從應用中刪除模擬器架構下(x86_64和i386)的建設進程:
殼牌:
/bin/sh
代碼:
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
解決方案:
有多了一個解決方案,如果你希望做它只有一次。 但是,請注意,在執行以下步驟之後,您將無法在模擬器上運行應用程序。在Testflight/App-Store上部署應用程序之前執行此操作。
從終端進入項目的ProjectFramework.framework文件夾。運行以下命令:
lipo -remove i386 ProjectFramework_SDK -o ProjectFramework_SDK
lipo -remove x86_64 ProjectFramework_SDK -o ProjectFramework_SDK
檢查從框架結構?
$ lipo -info PathToProject/ProjectName.framework/ProjectName
輸出將是: →架構FAT文件:項目名是: 的i386 x86_64的ARMv7的arm64
參考。 DOC: http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
去建立設置 - >爲「結構」進行搜索,你可以在那裏檢查「架構」選項卡,通常默認情況下它必須是armv7,arm64架構,請檢查哪一個顯示給你 –
此外,有時上述錯誤是由於不適當的構建,請清理,然後建立,然後archieve和上傳(不要忘記清理,然後建立)。讓我們再試一次..可能你會以這種方式獲得成功 –
我想問題是,一些使用的框架包含x86_64和i386體系結構。所以必須手動刪除它。 – user1046037