How to rebuild Info.plist on each run in Xcode
If you define some variables in projects settings that are included in Info.plist (usually, it is build version), you may notice that Info.plist is not always up to date. This is because when you change the variable in project settings, the Info.plist is not actually modified and Xcode may skip its compilation.
If you try to add Run Script phase with “touch $PROJECT_DIR/Info.plist”, it won’t help much because it will always run after processing of Info.plist. At best, Info.plist will be up to date every other run. It is very confusing to say the least.
How to fix:
1. Add a new target “Other” — “Aggregate” with a name “TouchInfoPlist”
2. Add Run Script phase with this line: touch $PROJECT_DIR/Info.plist
3. Go to your actual product targets, select Build Phases tab and add dependency TouchInfoPlist.
4. Edit schemas and remove schema “TouchInfoPlist”. You’ll never need to run it directly.
Enjoy always up to date Info.plist.
