Two Google Firebase projects in one OS X application?

426 views
Skip to first unread message

Marc Tamarit

unread,
May 19, 2016, 12:37:22 PM5/19/16
to Firebase Google Group
Is possible have 2 Google Firebase projects in 1 OS X application? I have seen you must type your bundle ID for integrate, then add a .plist in your project. Can I add two plist of two different projects?

Jay

unread,
May 19, 2016, 2:13:27 PM5/19/16
to Firebase Google Group
Firebase discontinued all support for OS X with this release so you may want to search for another provider.

If you upgrade you app, even if you could access the Firebase projects from your OS X application, it's not supported.

Previously, yes, you could do that easily.

Mike Mcdonald

unread,
May 19, 2016, 5:58:49 PM5/19/16
to Firebase Google Group
I totally understand your frustration on us not having OSX features for all features (and for us not providing a new Database version on day 0). To be clear, we haven't officially discontinued support for OSX; we're currently looking at what our SDKs look like on OSX, tvOS, and watchOS to see which features will make sense on these platforms, and how we can make the best possible experience on each platform

OSX issues aside, this is actually really easy to do: all you need to do is create a separate Firebase Application and you can connect to multiple database (yes you'll need to create another plist, but you'll have to manually set up the options in it using the code below):

FIRDatabase().database() // gets you the default database

let options
= FIROptions(googleAppID:  bundleID: , GCMSenderID: , APIKey: , clientID: , trackingID: , androidClientID: , databaseURL: "https://othernamespace.firebaseio.com", storageBucket: , deepLinkURLScheme: ) // fill in all the other fields
FIRApp.configureWithName("anotherClient", options: options)
let app
= FIRApp(named: "anotherClient")
FIRDatabase.database(app: app!) // gets you the named other database


Let me know if this makes sense!


Thanks,
--Mike

Jay

unread,
May 19, 2016, 6:43:47 PM5/19/16
to Firebase Google Group
The OP asked about 1 OS application, I believe your solution is to create a separate Firebase Application, which would be 2.

However, I do understand the answer and it's very helpful - I think it may help the OP.

Please see the following thread re: OS X comments

Mike Mcdonald

unread,
May 19, 2016, 9:37:07 PM5/19/16
to Firebase Google Group
I think there might have been some confusion regarding terminology, sorry. 

Firebase lets you create a project, which can contain multiple applications (Android, iOS, web, etc.). Currently, resources (such as Storage and the Database) are project wide--all applications access the same database and storage bucket (as configured in the GoogleServices-Info.plist). In order to get multiple databases, you'll need multiple projects (this is also something we're actively working on). It also means that since we're currently 

Given the you can create two Firebase Projects, each with a database, and use the code above to connect to those databases within the same iOS or OSX application, it sounds to me like this is what the OP asked for (though this may have been conflated with the question of: "can you put two database URLs in the same plist (thus the same project) and reference them both," to which the answer would be no).

It's also worth noting that we haven't deprecated the 2.x OSX libraries--they'll work fine with the existing Realtime Database and Auth system. You can have an iOS app on the 3.x SDK and an OSX app on 2.x. You can still use the FirebaseOSX pod with the old configuration and things will still work moving forward. While it's true that you won't get access to the latest features yet, it won't break existing apps and it's even fine for new development (even though I agree that there is uncertainty with this route).

Sorry for the confusion, hopefully this helps clear things up. I'll add some comments to the other thread on 

Thanks,
--Mike
Reply all
Reply to author
Forward
0 new messages