-1

I want to replace some placeholders in my .pbxproj file with real data before the compilation occurs. In a plain text of .pbxproj I have entries like REPLACE_ME_BUNDLE_ID or REPLACE_ME_TEAM_ID in place of app's bundle identifier and Development team respectively.

May I use a Run-script phase for that? Or is Xcode known for saving the .pbxproj in some safe place before the build and use it from there?

UPD: I do not use any xcconfig files, nor these placeholder values are declared anywhere. The question specifically is whether Xcode copies and hides the .pbxproj before the build starts and uses that copy, or am I allowed to modify the .pbxproj during the build?

Andrey Solovyov
  • 551
  • 7
  • 21
  • Can you please specify what 'placeholders' you are referring to? – Aman Shankar Sharma Jan 23 '23 at 18:02
  • @AmanShankarSharma Sure. In a plain text of .pbxproj I have entries like REPLACE_ME_BUNDLE_ID or REPLACE_ME_TEAM_ID in place of app's bundle identifier and Development team respectively. – Andrey Solovyov Jan 23 '23 at 18:11
  • @AndreySolovyov What are you trying to achieve? Why do you want to use runscripts in order to modify these values? If you explain in more detail, maybe we could find another (better) way out – arturdev Jan 23 '23 at 20:08

1 Answers1

1

These values will be replaced by the actual values before compilation.

Compilation will not succeed if these values are used as-is.

The values will be picked up based on the project 'Configuration' currently set as-per the build scheme (or as-specified in the build command if that is how the build has been initiated). You may locate actual values of these placeholders under build settings of your xcode target, and in-some cases they might come from the environment.

If this helps, kindly consider marking this as the answer, or else please comment and let me know further detail about what you're trying to do, so that I may give it more thought and try to to help you.

  • I am afraid they will not. The values for them are not declared anywhere, and my idea is to populate the placeholders with values is by using a script in a Run script phase, directly modifying and rewriting the .pbxproj, so avoiding any use of xcconfigs, schemes etc. – Andrey Solovyov Jan 23 '23 at 20:14
  • OK, thank you for your response. I have two things to say. One, if you can give me a couple of examples of such values, then we can look into it further. Two, some of those values are also picked-up from the environment variables. Are these 'placeholders' ones that are already present, or have you added these? Because if you've added them then you can define the values under build settings using 'user defined attributes'. As I said, a couple of examples and understanding where these are coming from (defined by you or created by xcode) would help. – Aman Shankar Sharma Jan 24 '23 at 05:24