I have two custom build configs development and release with some values defined. Here is what my Development.xcconfig looks like:
//
// Development .xcconfig
//
// Include Pods config.
#include "Pods/Target Support Files/Pods-MyApp/Pods-MyApp.debug.xcconfig"
// Server URL
HOST_NAME = 127.0.0.1:6060
// Use TLS (https, wss)
USE_TLS = NO
// App Settings
APP_NAME = MyApp (test)
APP_BUNDLE_ID = co.my-domain.myapp-test
I reference these values in Info.plist as $(HOST_NAME) and it works fine. But I also want to expose these custom parameters in application preferences as DefaultValue. I.e. I want the app to use localhost:6060 as default host name preference when the target is development and the address of production host when the target is release.
The preferences are defined in Settings.bundle/Root.plist. Unfortunately xcode does not expand references like $(HOST_NAME) in Settings.bundle/Root.plist. I suppose I have to write a build script to update the values. I know how to use PlistBuddy to update entries in Root.plist. What I can't figure out is how to read values from Info.plist and at what point in the build process I should update Root.plist.
I can't read Info.plist early in the build because the values are not yet expanded. The host name still reads as literal string "$(HOST_NAME)".
I suppose I can read the Info.plist as the last step in the build process and then update "$TARGET_BUILD_DIR/$EXECUTABLE_FOLDER_PATH/Settings.bundle/Root.plist", but which Info.plist to read, the one at
"$TARGET_BUILD_DIR/$INFOPLIST_PATH" or the one at
"$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"??? Does it matter? Are they always the same? Are they both always present?
Thanks!