How can we have different Info.plist files for different environments such as Dev, Test, Staging, and Prod?

后端 未结 3 2107
抹茶落季
抹茶落季 2021-02-07 12:18

How can we have different Info.plist files for different environments such as Dev, Test, Staging, and Prod?

I have some settings and a sep

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-07 13:17

    You can also create separate xcconfig files for each target, use the project manager to assign each target the correct xcconfig file, and then just define a variable with the same name in each xcconfig and import that variable into your single plist. For example:

    first xcconfig:

    MY_VARIABLE = suchandsuch

    second xcconfig:

    MY_VARIABLE = thisandthat

    And then in your plist, set a key with the value $(MY_VARIABLE)

    Depends on what exactly you're doing. Xcconfig is nice because you can access the variables you set there in places like build settings in addition to plist.

提交回复
热议问题