检查并删除 IPA/Archive 中不支持的架构 [x86_64, i386] [英] Check and Remove Unsupported Architecture [x86_64, i386] in IPA / Archive

查看:23
本文介绍了检查并删除 IPA/Archive 中不支持的架构 [x86_64, i386]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提交应用到App Store时,报如下错误:

While submitting the app to the App Store the following error is reported:

<代码>不支持的架构.您的可执行文件包含不受支持的架构 '[x86_64, i386]

  1. 如何解决上述错误?

  1. How can the above error be resolved ?

如何检查存档或 IPA 使用的架构?

How can I check the architectures used by the archive or IPA ?

我如何确保 Release 存档不包含 x86_64i386(模拟器架构).

How can I ensure that the Release archive doesn't include x86_64 and i386 (simulator architectures).

  • 是否只能通过脚本进行设置,还是在 Build Settings 或其他地方有设置?
  • Is it only possible through script or is there is a setting in Build Settings or else where ?

推荐答案

如果应用在分发过程中包含模拟器架构,Apple 已经开始抱怨.

Apple has started complaining if app contains simulator architectures during distribution.

如何解决上述错误?

解决方案:

在项目目标的运行脚本中添加以下代码,这会在构建过程中从您的应用程序中删除模拟器架构(x86_64 和 i386):

Add below code in run script of Project target, this remove the simulator architecture (x86_64 and i386) from your app on building process:

外壳:

/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 之前执行此操作.

There one more solution, if you wish to do it only once. But be careful though as after doing following steps, you will not be able to run app on simulator. Do it just before deploying the app on Testflight/App-store.

从终端进入项目的 ProjectFramework.framework 文件夹.运行以下命令:

Go inside the your ProjectFramework.framework folder of your project from terminal. Run following commands:

lipo -remove i386 ProjectFramework_SDK -o ProjectFramework_SDK 
lipo -remove x86_64 ProjectFramework_SDK -o ProjectFramework_SDK

从框架检查架构?

$ lipo -info PathToProject/ProjectName.framework/ProjectName

输出将是:→ fat 文件中的架构:ProjectName 是:i386 x86_64 armv7 arm64

Output will be : → Architectures in the fat file: ProjectName are: i386 x86_64 armv7 arm64

参考文档:http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/

这篇关于检查并删除 IPA/Archive 中不支持的架构 [x86_64, i386]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆