前言
本来今天高高兴兴,周末跑来公司把新版本提交审核,Archive->Export ipa->打开Application Loader,本以为和平常一样能够轻轻松松的搞定,没想到在用Application Loader提交的时候确报了一堆错误:
ERROR ITMS-90087: "Unsupported Architectures. The executable for
JunYouLawer.app/Frameworks/FoxitRDK.framework contains unsupported architectures
'[x86_64, i386]'."
ERROR ITMS-90362: "Invalid Info.plist value. The value for the key 'MinimumOSVersion' in
bundle JunYouLawer.app/Frameworks/FoxitRDK.framework is invalid. The minimum value is
8.0"
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at
'JunYouLawer.app/Frameworks/FoxitRDK.framework/FoxitRDK' does not have proper segment
alignment. Try rebuilding the app with the latest Xcode version."
ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO
load command is either missing or invalid, or the binary is already encrypted. This binary does
not seem to have been built with Apple's linker."
WARNING ITMS-90080: "The executable
'Payload/JunYouLawer.app/Frameworks/FoxitRDK.framework' is not a Position Independent
Executable. Please ensure that your build settings are configured to create PIE executables.
For more information refer to Technical Q&A QA1788 - Building a Position Independent
Executable in the iOS Developer Library.
看到这一堆报错,真是令人头大,但是没办法,有了错就得改啊,首先分析了一下这报错的原因,仔细发现报错的信息都指向了FoxitRDK.framework
,毫无疑问,罪魁祸首就是它了。于是又上网通过关键词搜索错误码看看有没有什么解决的方法,在stackoverflow找到了一篇文章,大概意思是报错的这个FoxitRDK.framework
里面包含了x86_64, i386 架构,解决方法就是通过在Xcode添加shell脚本去除x86_64, i386 这两个架构。
如何在Xcode里面添加shell脚本
-
首先在Xcode菜单栏Editor->Add Build Phase -> Add Run Script Build Phase
然后在Build Phases里发现多了一个Run Script
在红框里面添加以下代码:
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
ok,到了这里好像是没什么问题了,重新Archive打包上传,最后发现架构的问题是解决了,可是还有一个错误没有解除
通过报错信息可以知道又是这个
FoxitRDK.framework
出了问题,原因是FoxitRDK.framework
这个框架的info.plist
文件里的MinimumOSVersion
最小值是8.0,于是去找到这个info.plist文件,把MinimumOSVersion
改为8.0。
OK,重新Archive打包上传,Success,大功告成!!!