I have a project I've been messing around with for a while and recently I decided to re-write it in Swift. As part of doing this I took a look at the technologies I had employed for the server, asking myself 'Should I persist with these technologies?'
The short answer was - No.
This worked fine until I attempted to create some data which crashed and burned because Firebase Databases have security enabled by default. Some reading later and I worked out I needed to add in authentication. Some more reading after that and I figured out Firebase Database can use a wide range of authentication systems, one of which was Google's single sign in solution. AKA Your google Id. This seemed perfect as I've used my Google Id for authentication in the past and it should integrate seamlessly with Firebase Database.
Despite what Google's integration documentation says, combining Firebase Database and Google Sign In in the same project caused the compiler to throw a teeny tiny tantrum, spitting out numerous duplicate symbol errors. The culprits being a number of classes duplicated in both the Firebase and Google Sign In SDKs.
I thought 'No, this can't be right. I must have done a boo boo somewhere' and hit the inter webs again. But after a lot more reading I concluded I'd actually done it right for once, and it was Google who had stuffed up as supported by this StackOverFlow question which also gave me a solution. Basically it said:
- Copy the GoogleSignInDependencies.framework to a tmp directory.
- Extract the binaries for the various architectures.
- Extract the individually compiled class binaries.
- Remove the duplicate class binaries which clash with the Firebase binaries.
- Combine the left over binaries back into a new framework.
- Include this new framework in your project.
Honestly I had doubts that was the best solution. I mean - hacking Googles binaries? WTF!
So I shot a question at Google who (to their credit) emailed me back the next day. They pointed me at the same StackOverFlow question I'd found and suggested that was the best answer they could offer.
They were telling me to patch their own product so it would work the way their instructions said it should in the first place! - Gotta admit, I was a bit gob smacked.
So long story short, I went and followed the StackOverFlow answer, tearing GoogleSingInDependencies apart and re-assembling it. So far, it's worked. I'm no longer getting compilation problems and everything appears to be working, although I've not used much of Firebase's functionality as yet.
So the summary of this waffle is this:
- I'm still surprised a company can put out two products like Firebase and Google Sign In, and recommend to use them together when they know you can't without some relatively advanced skills.
- I wrote a script to do all the dirty work of fixing the framework. It works for me, hopefully it will help someone else.