livings124
livings124

Reputation: 1113

Preprocess Root.plist similar to Info.plist

I have enabled Preprocessing of Info.plist in the Xcode build settings, to replace the key representing the version number in CFBundleVersion with the corresponding value in a version.h. This works great: VERSION_NUMBER is replaces with 1.0 for the corresponding #define VERSION_NUMBER 1.0 in version.h. I would like to do the same in Root.plist, where the plist is updated when placed into the .app/.ipa.

Right now I have a script to automatically update Root.plist on each compile, but that updates the actual Root.plist, meaning I will have to resubmit to version control, etc. I want to generate a Root.plist in the compiled app, but not touch the "real" plist.

Any help would be appreciated. Thanks!

Upvotes: 1

Views: 868

Answers (1)

MrTJ
MrTJ

Reputation: 13192

As far as I know the only way to do it is from build time scripts as you do. You can work around the version control issues by the following trick:

  • rename your "template" Root.plist (i.e. that one having preprocessor directives) to something like Root-template.plist
  • call the preprocessor from your script and output it to Root.plist
  • commit Root-template.plist to your version control
  • add Root.plist to the ignore list of your version control (for example if you use svn, you'll have to add Root.plist to the svn:ignore property of the directory containing the file)

Upvotes: 1

Related Questions