app打包上传遇到的问题

app使用a'rchive打包上传ipa时遇到一个问题:

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'tinsine.app/Frameworks/Hyphenate.framework/Hyphenate' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

ERROR ITMS-90087: "Unsupported Architectures. The executable for tinsine.app/Frameworks/Hyphenate.framework contains unsupported architectures '[x86_64, i386]'."

问题是Hyphenate.framework 没有使用真机库。

解决方法是生成binary的时候使用一段script来去掉那些不支持的结构。

在Xcode中选择项目->targets->Build Phases, 找到Embed Framework。

然后在Xcode的菜单栏Editor->Add Build Phase->Add Run Scrip Build Phase。

如下图:



于是在Embed Framework下面会出现Run Script。

Shell填入:/bin/sh

下面输入这段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


操作如下图:



然后重新archive即可。


猜你喜欢

转载自blog.csdn.net/huanglinxiao/article/details/73882526
今日推荐