Search code examples
iosxcodebuild

iOS: Changing info.plist during build phase


I am trying to do the following:

  1. During the build phase, open a plain text file and read the text
  2. Change the value of a property in info.plist to the value obtained in step 1.

Can I write a shell script for this?

It will be great if someone can guide me to achieve this.


Solution

  • Yes you can. I would do it in three steps:

    1. Write a shell script that is run before the first build-phase. Let this script set an environment variable.
    2. Enable "Expand Build Settings in Info.plist" for you project.
    3. Use the environment variable in the plist file like ${MY_COOL_SETTING}.