In my project I have different targets for the same app with different configurations (Production / Staging / QA). As suggested by the Firebase docs I added a plist
file for each trarget and initializing FirebaseApp by passing the correct configuration file in this way:
let configPath = Bundle.main.path(forResource: NAME_OF_PLIST_FOR_CURRENT_TARGET ofType: ".plist")!
let options = FirebaseOptions(contentsOfFile: configPath)!
FirebaseApp.configure(options: options)
I also removed from my project the GoogleService-Info.plist
file as suggested in docs here to ensure reliable Analytics reports.
When I run the app in the console I see these messages.
[Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
[Firebase/Analytics][I-ACS020006] Google App ID from GoogleService-Info.plist is empty. Please, define GOOGLE_APP_ID in GoogleService-Info.plist for Analytics to work reliably. See
[Firebase/Analytics][I-ACS025020] Analytics requires Google App ID from GoogleService-Info.plist. Your data may be lost. Google App ID has been changed. Original, new ID: (nil), MYAPPID
Am I doing something wrong? Could this configuration lead to lost Analytics? (as console message suggest)
'Firebase/Core'
to the project. Also, when using a singleGoogleService-Info.plist
everything works (my app is in production already and Analytics is working). – Dickinsonoptions.googleAppID
before passingoptions
toFirebaseApp.configure
I get the correct value. – Dickinson