简体   繁体   中英

Have two GoogleService-Info.plist in one target in XCode

I have two different environments setup in on target (one for development and another for production), because of that i want to use two different GoogleService-Info.plist but still without success. Is there a way to do it?

I use the following solution:

Create a GoogleService-CONFIGURATION-Info.plist file for every XCode configuration. Don't link the files to a target.

Add a Run Script Build Phase:

cp ${SRCROOT}/Resources/Firebase/GoogleService-${CONFIGURATION}-Info.plist ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleService-Info.plist

  1. keep the same names for both GoogleService-Info.plist
  2. put one GoogleService-Info.plist inside a subfolder, say "development"
  3. add references to both files in Xcode, while link them to corresponding targets
  4. just use FIRApp.configure() in your AppDelegate, done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM