ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [iOS] Build Version을 수정해도 바뀌지 않을 경우 체크해보세요
    iOS /iOS 문제해결 2019. 1. 8. 09:24

    기존에 진행되던 프로젝트의 빌드번호를 General 탭에서 수정해도 안바뀌어서 이상하다고 생각하던 중 확인을 못했던 부분이 있었습니다. 


    Build Version 을 수정하는 방법은 2가지가 있습니다. 


    1.  Geneal 탭에 있는 Build를 수정한다.

    2. 프로젝트명-Info.plist 파일에서 항목을 찾아 수정한다. 



    이 두가지 방법으로  빌드번호를 변경해도 바뀌지 않는 경우 다음을 체크해보시기 바랍니다. 


    프로젝트 -> Build Phases -> Run Script 부분에 git 라인수를 가져와 빌드번호로 업데이트 시켜주는 코드가 들어 있을 경우

    Build Version을 수동으로 업데이트 시켜줬을 시에 적용이 되지 않습니다.



    해당 코드를 주석 처리하거나 지워주시면 해결됩니다. 


    반대로 빌드번호를 자동화 하고싶다면 해당 부분에 스크립트를 추가해주시면 됩니다. 



    #

    # Set the build number to the current git commit count.

    # If we're using the Dev scheme, then we'll suffix the build

    # number with the current branch name, to make collisions

    # far less likely across feature branches.

    # Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/

    #

    git=`sh /etc/profile; which git`

    appBuild=`"$git" rev-list --all |wc -l`

    if [ $CONFIGURATION = "Debug" ]; then

    branchName=`"$git" rev-parse --abbrev-ref HEAD`

    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

    else

    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"

    fi

    echo "Updated ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"


    'iOS > iOS 문제해결 ' 카테고리의 다른 글

    Cocoapod의 IBDesignable 문제해결  (0) 2018.12.18
2019 Fernando.