报这个错一般是由于自己制作的framework 包含了x86_64, i386 架构,这个是苹果不允许的。
解决办法:剔除掉x86_64, i386这两个架构
三种办法:
1、重新打包解决
2、工程中添加shell脚本来解决
3、通过终端来去除
脚本如下:
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_EXECUTAB LE_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
还要注意一点,这样的话可能会报很多错:
这样的话需要修改一个地方就可以了,因为不是全部的sdk 都需要,只修改对应的就可以了。
$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
"$APP_PATH" -name '[frameworkname].framework' -type d | while read -r
参考资源:http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
http://stackoverflow.com/questions/35240330/errors-building-xcode-project-after-adding-in-run-script-fatal-error-lipo-inpu
终端去除办法:
有些第三方提供商为了方便开发者使用,经常把 i386 x86_64 armv7 arm64 等几个平台合并到一起,但是上传App Store的时候需要将i386 x86_64 两个平台删除后,才能正常审核。
先查看一下framework 包含的平台:
lipo -info XXXX.framework/XXXX
或者
cd XXXX.framework
lipo -info XXXX
Architectures in the fat file: XXXX.framework/Realm are: i386 x86_64 armv7 arm64
执行以下命令进行剔除:
mkdir ./bak
cp -r XXXX.framework ./bak
lipo XXXX.framework/XXXX -thin armv7 -output XXXX_armv7
lipo XXXX.framework/XXXX -thin arm64 -output XXXX_arm64
lipo -create XXXX_armv7 XXXX_arm64 -output XXXX
mv XXXX XXXX.framework/
然后可以用lipo -info 查看一下这样就得到了去除i386 和 x86_64 的framework 了。
我就是用这个方式去除的i386和x86_64,亲测可用,留作备忘
————————————————
原文链接:https://blog.csdn.net/wutengwei007/article/details/70214509