ipa打包上傳錯誤90080,80087,90209,90125

錯誤類型90080,80087,90209,90125
  • 緣由:第三方framwork包含了x86_6四、i386的架構,AppStore不容許上傳
  • 解決辦法: 參考stackoverflow上解決方案,在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"
        echo "Extracting to $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[@]}"
    echo "merged to ${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
  • 有個疑問:不知道爲何.a裏面包含x86_64這些是沒有問題的 後續:該疑問已經獲得解答,參考該篇

後續:以上腳本存在問題,具體以下:xcode

  1. 編譯完某個機型後,再換另外一中arm的機型編譯會報錯:
fatal error: lipo: -extract armv7 specified but fat file: /Users/yaozhaofeng/Library/Developer/Xcode/DerivedData/TKLobby-hhxvnfiigsbhwbairrsjlyhytkaa/Build/Products/Debug-iphoneos/TKLobby.app/Frameworks/AliThirdparty.framework/AliThirdparty does not contain that architecture

緣由是xcode並不會每次編譯的時候都embeded內置的framwork,第一次編譯後已經將framwork修改成只有某一種arm的版本,等下次編譯另外一種arm的時候,就會發現找不到對應的arm了。架構

  1. 工程clean以後,再次編譯的時候,腳本中的while循環沒法進入,緣由是這個狀況下xcode尚未將工程中的framwork拷貝到目標文件夾中,因此find命令查找framwork的時候根本找不到

針對第一個問題,有網友進行了補充以下,可是該方案目前看依然沒法解決問題2app

後續:找到問題2解決方案: Run Script的執行順序,取決於它在build phases中添加的位置,針對問題2,將腳本位置放到Embed Frameworks以後便可iphone

cho "Target architectures: $ARCHS"

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

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"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp"

# remove simulator's archs if location is not simulator's directory
case "${TARGET_BUILD_DIR}" in
*"iphonesimulator")
    echo "No need to remove archs"
    ;;
*)
    if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386") ; then
    lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH"
    echo "i386 architecture removed"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
    fi
    if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64") ; then
    lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH"
    echo "x86_64 architecture removed"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
    fi
    ;;
esac

echo "Completed for executable $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

done
相關文章
相關標籤/搜索