简体   繁体   中英

Using same version number for multiple Xcode targets Info.plist

I have a single Xcode project with multiple targets.

Each target has its own Info.plist file with the version number of that application. ( CFBundleVersion and CFBundleShortVersionString )

How can I use single, common Version Number and Build Number source for each target, rather than editing each target's plist file?

The following works with Xcode 12 and does not require User-Defined variables.

  1. Select your project
  2. Select Build Settings and find "Versioning"
  3. Set "Marketing Version" to be your version
  4. Set "Current Project Version" to be your build

更新项目


  1. Next, select each of your targets
  2. Delete/remove any version number and it will use the default "Marketing Version"
  3. Delete/remove any build number and it will use the default "Current Project Version"
  4. Do this for all of your targets

更新目标


Once you do this, you only need to update the "Marketing Version" and "Current Project Version" for the Project and all of your targets will be updated accordingly.

Add a new custom property to your project ( Editor -> Add Build Setting -> Add User Defined Setting ). Let's name it MY_VERSION and let's give it value 1.0.1 .

Now go to the Info section of every target and set the version to ${MY_VERSION} .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM