Should I erase build number when uploading a new version?
As others have mentioned, you should not reset the build number for new versions.
A method I often use is to add a script to the build phases of the target. That way, the build number continually updates without manual intervention.
In my case, I base the build number on the number of Git commits, but you can alter that to meet your needs.
REV=`git rev-list HEAD | wc -l`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $REV" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
Technically for an iOS app the build number could start from 0 (or 1) again. For a Mac app that is not allowed. Wether you SHOULD do that is a different question.
Convention is that the build number always increments, also after a version number change.
See Apple's description of this: https://developer.apple.com/library/content/technotes/tn2420/_index.html
From the ios docs
For every new build you submit, you will need to invent a new build number whose value is greater than the last build number you used (for that same version). For iOS apps, you may re-use build numbers when submitting different versions. For macOS apps, you must chose a new build number for every submission that is unique and has never been used before in any submission you have provided to the App Store (including build numbers used in previous versions of your app).
So you can use 1.0.1 (1)
or 1.0.1(31)
but I would really prefer later one. I couldn't remember during my development remembering version number, we always refer build version within the team. And our build version is always greater than the previous build version.
You can ask why we follow this? The answer is because it looks logically right for us and also android versioning follows the same thing
From android docs
versionCode — An integer used as an internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName setting, below. The Android system uses the versionCode value to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device.
For an iOS app versioning the version would consist of 1.2.3, 1 being a major release, 2 being a minor release and 3 being the bug fixes. For every build version we can have as many builds as possible starting from any number. As per versioning standards we follow it from 1 whenever the version increases and build version always increases.