Search code examples
iosxcodeproject-settings

XCode: can I overwrite CFBundleVersion with value in xcconfig?


Is there a way to use value defined in xcconfig to overwrite the value in project settings like CFBundleVersion? I tried to add a key-value say:

MyVersion = 1.5

and set it in Info plist as ${MyVersion} for Bundle version, but it doesn't work.

Thanks!


Solution

  • xcconfig file variables are referenced without brackets or paren, like this: $MyVersion.

    You also need to assign the xcconfig to the configurations in the project settings. Click project in the left pane, then click your project in the middle pane, then find the configurations section, then expand each configuration (debug, release, etc.) and assign the xcconfig using the dropdown for each target.

    Full tutorial here: https://burcugeneci.wordpress.com/2015/09/24/using-xcconfig-files-and-custom-schemes-for-your-xcode-project/