Xcode: Increment build number

若如初见. 提交于 2019-12-24 18:48:32

问题


We use a script that creates a time stamp and replaces the apps build number.

#!/bin/bash
echo "Update Build Number to Timestamp"
echo "--------------------------------"
# fail on error
set -e
agvtool new-version -all $(date +%Y%m%d%H%M%S)

This changes the build number to something like this: 201703241425.

We introduced an in-house framework to our Project.

The command above also replaces the frameworks Build number and Current Library Version. However, the builds fail with the following error:

▸ Linking In-HouseFrameworkLayer

❌  ld: malformed 64-bit a.b.c.d.e version number: 201703241425
❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

When I change the format for the framework's Build number, Current Library Version to 1.0.0 and do a build without using the script above, the builds are successful.

Question: How can I change the Build number ONLY for the app, but NOT the framework Current Library Version number?


回答1:


Obviously the app uses CFBundleVersion + $(CURRENT_PROJECT_VERSION); libraries/frameworks are supposed to use (Current Library Version) + $(DYLIB_CURRENT_VERSION)

By default it is set to $(CURRENT_PROJECT_VERSION), so this is what you'll need to change to the $(DYLIB_CURRENT_VERSION) string.

Important: For macOS apps, build numbers must monotonically increase even across different versions. In other words, for macOS apps you cannot use the same build numbers again in different release trains. iOS apps have no such restriction and you can re-use the same build numbers again in different release trains.

The value for a version number or build number must consist only of '.'s and numbers and must begin and end with a number. Each integer value separated by a period is a component of the version. The maximum number of characters in your version number or in your build number cannot exceed eighteen characters in total.

iOS version numbers and build numbers may have three or more components, but the maximum size of the entire version number or build number must not exceed eighteen characters.

macOS apps are somewhat more restrictive than iOS apps. For macOS apps there is a limit of three components separated by periods and there may not be any more than three components.

↳ Version Numbers and Build Numbers

↳ Automating Version and Build Numbers Using agvtool



来源:https://stackoverflow.com/questions/43009669/xcode-increment-build-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!