Using FIRApp's configureWithOptions to point to different configuration plist

1,012 views
Skip to first unread message

Shawn Paulson

unread,
Nov 10, 2016, 1:21:03 AM11/10/16
to Firebase Google Group
I am running an app with the Firebase 3.x SDK, and looking to conditionally use a different configuration .plist to point to a different Firebase location depending on whether the app is configured for development vs production.

I am trying to  use FIRApp's configureWithOptions to accomplish this, where I set a different plist path for the FIROptions that I pass as a parameter. However, when I use a path to something like "GoogleService-Dev-Info.plist" I get a console warning from Firebase/Core that states "GoogleService-Info.plist" could not be found. I see that all of the properties of the FIROptions object are populated with what I would have expected out of my GoogleService-Dev-Info.plist file, so I'm not sure what I'm not understanding. Is there something hardcoded in the Firebase SDK to go to GoogleService-Info.plist regardless of any options passed in?

Kato Richardson

unread,
Nov 10, 2016, 10:44:03 AM11/10/16
to Firebase Google Group
Shawn,

Can you please share specific version info (more specific than 3.x) as well as some code illustrating?

☼, Kato

On Wed, Nov 9, 2016 at 8:27 AM, Shawn Paulson <slpa...@gmail.com> wrote:
I am running an app with the Firebase 3.x SDK, and looking to conditionally use a different configuration .plist to point to a different Firebase location depending on whether the app is configured for development vs production.

I am trying to  use FIRApp's configureWithOptions to accomplish this, where I set a different plist path for the FIROptions that I pass as a parameter. However, when I use a path to something like "GoogleService-Dev-Info.plist" I get a console warning from Firebase/Core that states "GoogleService-Info.plist" could not be found. I see that all of the properties of the FIROptions object are populated with what I would have expected out of my GoogleService-Dev-Info.plist file, so I'm not sure what I'm not understanding. Is there something hardcoded in the Firebase SDK to go to GoogleService-Info.plist regardless of any options passed in?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7a7c16e4-49b2-4146-a7a7-f7dd2a22ab17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Todd Kerpelman

unread,
Nov 10, 2016, 1:54:49 PM11/10/16
to Firebase Google Group
Hmmm... are you sure you're getting the plist file the right way? You gotta include the whole path:forResource:ofType thing to get it, not just include the file name.

This worked for me:

    let plistPath: String!

    if (isDebug) {

      plistPath = Bundle.main.path(forResource: "GoogleService-Info-Debug", ofType: "plist")

    } else {

      plistPath = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist")

    }

    if let options = FIROptions.init(contentsOfFile: plistPath) {

      FIRApp.configure(with: options)

    } else {

      print("Couldn't find options file at \(plistPath)")

    }


--T




On Thursday, November 10, 2016 at 7:44:03 AM UTC-8, Kato Richardson wrote:
Shawn,

Can you please share specific version info (more specific than 3.x) as well as some code illustrating?

☼, Kato
On Wed, Nov 9, 2016 at 8:27 AM, Shawn Paulson <slpa...@gmail.com> wrote:
I am running an app with the Firebase 3.x SDK, and looking to conditionally use a different configuration .plist to point to a different Firebase location depending on whether the app is configured for development vs production.

I am trying to  use FIRApp's configureWithOptions to accomplish this, where I set a different plist path for the FIROptions that I pass as a parameter. However, when I use a path to something like "GoogleService-Dev-Info.plist" I get a console warning from Firebase/Core that states "GoogleService-Info.plist" could not be found. I see that all of the properties of the FIROptions object are populated with what I would have expected out of my GoogleService-Dev-Info.plist file, so I'm not sure what I'm not understanding. Is there something hardcoded in the Firebase SDK to go to GoogleService-Info.plist regardless of any options passed in?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7a7c16e4-49b2-4146-a7a7-f7dd2a22ab17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shawn Paulson

unread,
Nov 10, 2016, 4:30:54 PM11/10/16
to Firebase Google Group
I just grabbed AuthenticationExample sample project and it looks like the version of FirebaseCore is 3.4.3 based on the CocoaPods log.

Sample code is below, where I renamed my GoogleService-Info.plist in the project to GoogleService-Dev-Info.plist:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Dev-Info" ofType:@"plist"];

FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];

FIRApp configureWithOptions:options];


After the call to configureWithOptions I see the following console warning:

2016-11-10 11:09:36.792 AuthenticationExample[77556] <Error> [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.

2016-11-10 11:09:36.793 AuthenticationExample[77556] <Error> [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.


On Thursday, November 10, 2016 at 9:44:03 AM UTC-6, Kato Richardson wrote:
Shawn,

Can you please share specific version info (more specific than 3.x) as well as some code illustrating?

☼, Kato
On Wed, Nov 9, 2016 at 8:27 AM, Shawn Paulson <slpa...@gmail.com> wrote:
I am running an app with the Firebase 3.x SDK, and looking to conditionally use a different configuration .plist to point to a different Firebase location depending on whether the app is configured for development vs production.

I am trying to  use FIRApp's configureWithOptions to accomplish this, where I set a different plist path for the FIROptions that I pass as a parameter. However, when I use a path to something like "GoogleService-Dev-Info.plist" I get a console warning from Firebase/Core that states "GoogleService-Info.plist" could not be found. I see that all of the properties of the FIROptions object are populated with what I would have expected out of my GoogleService-Dev-Info.plist file, so I'm not sure what I'm not understanding. Is there something hardcoded in the Firebase SDK to go to GoogleService-Info.plist regardless of any options passed in?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7a7c16e4-49b2-4146-a7a7-f7dd2a22ab17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shawn Paulson

unread,
Nov 10, 2016, 4:30:54 PM11/10/16
to Firebase Google Group
I just modified your code and tried inserting the following into the authentication example project with a fresh pull of its dependencies from CocoaPods. Looks like the FirebaseCore version is 3.4.3.

let plistPath: String!

plistPath = Bundle.main.path(forResource: "GoogleService-Dev-Info", ofType: "plist")


if let options = FIROptions.init(contentsOfFile: plistPath) {

  FIRApp.configure(with: options)

} else {

 print("Couldn't find options file at \(plistPath)")

}


The options load properly for me, and the app appears to be configured properly. However, after the call to FIRApp.configure(with: options) I get the console warning below:

2016-11-10 12:58:48.117 AuthenticationExample[77881] <Error> [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.

2016-11-10 12:58:48.118 AuthenticationExample[77881] <Error> [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.


I'm trying to figure out if this is just noise due to an issue in the Firebase SDK (which would be unfortunate) or if I truly have a problem.

Todd Kerpelman

unread,
Nov 10, 2016, 5:15:01 PM11/10/16
to Firebase Google Group
Dumb question, but is there some other errant call to FIRApp.configure() sitting around your app?

--T

Shawn Paulson

unread,
Nov 10, 2016, 6:23:58 PM11/10/16
to Firebase Google Group
I did a find all and don't see any. I'm just running the AuthenticationExample project with the modifications mentioned above.

Todd Kerpelman

unread,
Nov 10, 2016, 6:39:21 PM11/10/16
to Firebase Google Group
So, I just tried this with the Auth example and it worked fine for me. Hmmm...

Okay, one last thing: Are you sure you're running the right target? There's two in the project, and if you're changing the Obj-C version but then running the  AuthenticationExampleSwift one, that would give you exactly the error you're seeing. 

--T


You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/Y-lZjENzXZ8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.

Shawn Paulson

unread,
Nov 11, 2016, 12:43:25 AM11/11/16
to Firebase Google Group
I have run both the Objective-C target with the corresponding Objective-C modifications, and the swift target with the corresponding swift modifications.

Everything seems to be working fine other than the console warning. I guess I must be missing something if you get no console warning at runtime.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.

Todd Kerpelman

unread,
Nov 11, 2016, 10:38:32 AM11/11/16
to Firebase Google Group
That's definitely strange. Only other thing I noticed is that I have Firebase Core 3.4.4 instead of 3.4.3. Maybe try a pod update?

--T


To unsubscribe from this group and all its topics, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Shawn Paulson

unread,
Nov 11, 2016, 8:46:50 PM11/11/16
to Firebase Google Group
The Firebase Core version was the issue. I'm new to CocoaPods, and didn't realize I needed to do a pod update. I did a pod install, but this must have ended up grabbing old versions that I must have already installed at some point.

After the update the console warning went away.

Thanks for your help in getting this solved.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Todd Kerpelman

unread,
Nov 14, 2016, 10:56:21 AM11/14/16
to Firebase Google Group
You're welcome. Glad everything's working.

--T


To unsubscribe from this group and all its topics, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages