Heuristic
Heuristic

Reputation: 5341

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!

Upvotes: 2

Views: 1490

Answers (2)

jjxtra
jjxtra

Reputation: 21140

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/

Upvotes: 1

hirschfl
hirschfl

Reputation: 46

You need to bracket your variable in round brackets like this: $(MyVersion) instead of ${MyVersion}

Upvotes: 0

Related Questions