2

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!

Heuristic
  • 5,087
  • 9
  • 54
  • 94
  • Hi, hzxu, have you got the solution for this question, because I am facing the same issue , I have not the solution yet. – vnaren001 Apr 06 '16 at 14:32
  • @vnaren001 No I haven't found a way to overwrite it, what I did in the end is to have a build script in the build phase to manually do it. – Heuristic Apr 18 '16 at 06:54
  • Thanks @hzxu for reply, I did the same as you did , I wrote a run script in build phase. – vnaren001 Apr 19 '16 at 06:20

2 Answers2

1

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/

jjxtra
  • 20,415
  • 16
  • 100
  • 140
0

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

hirschfl
  • 46
  • 3