2017年2月23日 星期四

iOS tips - ERROR-ITMS-90087 solution

最近把project的third party從cocoapod改成Carthage來管理,當專案不是一個人在搞的時候cocoapod有時真的很難一起協作。用Carthage之後基本上就是多加一個framework,日後要單獨update一個特定的library也是比較方便。但就像往常一樣,天底下沒有白吃的午餐,也絕對沒有一試就沒有bug的tool。當小弟準備Archive要上傳到itunes connect的時候,出現了 ERROR-ITMS-90087,跟google大神拜了三個響頭之後,得到下面解答,基本上就是在build phase裡加上這個script就能解掉這個error了...太神了。
(P.S. 因為我的third party library是cocoapod跟carthage都有使用,跟只有用carthage的script會不太一樣)

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
參考出處:
http://stackoverflow.com/questions/30547283/submit-to-app-store-issues

2017年2月6日 星期一

iOS tips - Run app from cold start

最近測試從外部的URL來開啟app,但卻不太明白要怎麼測試app not running狀態下的情況。Stakeoverflow後找到了Xcode設定的方法

首先點選目前Target的圖示,再點選Edit scheme


找到Run section的radio button,把"Automatically"改成"Wait for execution to be launched"



這樣compile完之後就不會自動開啟,會等到手動開啟app,或從外部link開啟app才會執行debugging了。