Use same CFBundleVersion and CFBundleShortVersionString in all targets

前端 未结 7 2143
南旧
南旧 2020-12-31 08:31

I received the following email from Apple when I submit an app update:

We have discovered one or more issues with your recent delivery for \"Project

7条回答
  •  没有蜡笔的小新
    2020-12-31 09:02

    There is a really sweet version management system that Twitch has shared.

    Described in this blog post, it is somewhat similar to stk's accepted answer but cleaner and also supports the following:

    • Ties the build number directly (and reversibly) to the git commit before the build. Go back easily to the exact version built for use with crash report.

    • Handles version generation through a target dependency, which is easier to share across multiple targets.

    • Uses C Preprocessor on Info.plist functionality built into Xcode build settings to allow the version numbers to be substituted on the fly, with no modification of the Info.plist file.

    It is a little more complex to implement, but it's the best solution I've found, particularly if you have extensions or other targets whose versions must be kept in sync.

    Installation Notes: Note the blog does a great job of describing the four shell files, but doesn't really give installation or customization instructions. Here's what I did:

    1. Create a Versions subdirectory at the top level of your project (where the .xcodeproj lives).

    2. Download the four files indicated from the gist link at bottom left of the code samples. Move the four files into your Versions directory.

    3. Using terminal, cd to your Versions directory, then execute the cmd: chmod +x * to make the shell files executable

    4. Now follow the directions in the blog from the start to create your dependency target.

    5. You probably should customize the scripts a bit. I altered the naming and refactored to move the 4 tools to a separate tools directory that I share across projects. YMMV.

提交回复
热议问题