Xcode not adding newly generated plist after run script phase

163 views Asked by At

I'm trying to follow this article https://peterfriese.dev/reading-api-keys-from-plist-files/ in an attempt to add a run script where a plist is generated from a sample plist that exists in the directory. Upon executing the script it correctly copies the content from the sample plist and generates the new plist(Test-Info.plist) into the root of the project. enter image description here

The issue I have is that when the script has completed running, Xcode is unable to find the new plist generated. If I manually drag and drop the new plist into Xcode it works however I'm trying to see how Xcode can add the new plist without manual intervention.

CONFIG_FILE_BASE_NAME="Test-Info"

CONFIG_FILE_NAME=${CONFIG_FILE_BASE_NAME}.plist
SAMPLE_CONFIG_FILE_NAME=${CONFIG_FILE_BASE_NAME}-Sample.plist

CONFIG_FILE_PATH=$SRCROOT/$PRODUCT_NAME/$CONFIG_FILE_NAME
SAMPLE_CONFIG_FILE_PATH=$SRCROOT/$PRODUCT_NAME/$SAMPLE_CONFIG_FILE_NAME

if [ -f "$CONFIG_FILE_PATH" ]; then
  echo "$CONFIG_FILE_PATH exists."
else
  echo "$CONFIG_FILE_PATH does not exist, copying sample"
  cp -v "${SAMPLE_CONFIG_FILE_PATH}" "${CONFIG_FILE_PATH}"
fi

I'm guessing the script needs to be modified so when the new plist is generated not only should it be added to the root but also the Copy bundle Resources phase which I'm unsure to do. Any help would be appreciated.

0

There are 0 answers