Search code examples
iosiphonexcodefirebasefirebase-crash-reporting

firebase crash reporting supporting multiple environments


Google states to do the following. https://firebase.google.com/docs/configure/#support_multiple_environments_in_your_ios_application

I only want to have 1 target, and use the different names for the GoogleService plist files, that google explains afterwards.

However, whenever the crash reporting dependency is added and the google service plist is not named exactly GoogleService-Info.plist a script fails stating the error

SERVICE_PLIST: GoogleService-Info.plist could not be located.

Why does google say you can support multiple environments by changing the name, but crash reporting is hardcoding the default GoogleService plist name?

Is there a work around for this?


Solution

  • This solution will work if you have 1 targed and multiple build configurations.

    So if you take a closer look at the upload-sym file you will notice that it will only search for GoogleService-Info.plist file only if it can't find ${FIREBASE_API_KEY} and ${FIREBASE_APP_ID} . So I managed to fix it by adding FIREBASE_API_KEY and FIREBASE_APP_ID in the user-defined settings Editor -> Add Build Settings -> Add User-Defined Setting .

    FIREBASE_API_KEY=API_KEY from your GoogleService-Info.plist
    FIREBASE_APP_ID=GOOGLE_APP_ID from your GoogleService-Info.plist
    

    So I have GoogleService-Info-production.plist and GoogleService-Info-development.plist. Copy the correct ones for the appropriate configuration. And crash reporting works for me. Hope this helps for somebody else.