Apple开发_工程调试次数,自动计数

工程->targes -> build phase-> +run script

  • 将下列代码加入.

    #update build version
    ## Get project info
    buildPlist="${PROJECT_DIR}/${INFOPLIST_FILE}"
    buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$buildPlist")
    versionString=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$buildPlist")
    ## Increment build number for every build
    if [ "$CONFIGURATION" == "Debug" ] || [ "$CONFIGURATION" == "Release" ]; then
    ## Increment the buildNumber (A.K.A CFBundleVersion)
    buildNumber=$(($buildNumber + 1))
    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$buildPlist"
    fi
    
posted @ 2022-11-09 10:07  CH520  阅读(9)  评论(0编辑  收藏  举报