I am trying to implement Google Analytics (GA) in my iOS apps. I have two different targets that have different tracking-ids for GA. GA requires a GoogleService-Info.p
I did correctly all along, however Destination
should be set to Wrapper
and subpath empty. No need to have them in the target either.
This one explained the Destination options: xcode copy files build phase - what do the destination options mean exactly?
The script:
PLIST_FILE="CustomGoogleService-Info.plist"
PLIST_PATH="${PROJECT_DIR}/path/To/Plist/Here/${PLIST_FILE}"
cp "${PLIST_PATH}" "${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/GoogleService-Info.plist"
Instructions:
Build Phases
CustomGoogleService-Info.plist
to your ownpathToPlistHere
to the correct path where CustomGoogleService-Info.plist
is located (starting from your project directory)GoogleService-Info.plist
file in your project - the script will create it for you.You may be interested in reading Apple's Xcode Build Setting Reference
Alternatively:
You could have 2 files with the name GoogleService-Info.plist
, but keep each in separate directory. Then you could add each to the corresponding target. Without any script.