Firebase issues!

Is anyone having any success with the Firebase frameworks, particularly Google Mobile Ads, in their iOS apps?

I cannot for the life of me get the ads working. I have been through these excellent threads from @matkatmusic but cannot replicate what he has achieved

The guides are 4 years old now and I can only guess that some things have changed since then. Firstly, I cannot get the .xc frameworks to be detected by Xcode when I add them to the custom frameworks section. The only way I can seem to get them loaded into the project is if I embed them, but I think this may be the wrong way to do it. I can build at this point, but the app fails to install (on simulator) with this error message

When I follow that folder structure there is no such folder beyond ‘com.apple.mobile.installd.staging’, as in it is empty.

Going back to the embedding of the framework, the problem I am having looks like it could be the same as this App Won't Compile with Embedded Th… | Apple Developer Forums

I’m pulling my hair out with it, as I’m sure it is not as complicated as it seems to me. I must confess I don’t know much about static and dynamic libraries and how they need to be structured. I did try and load the frameworks in as libraries (firebase.a) but again they could not be detected by Xcode. Any pointers in the right direction would be hugely appreciated, as I’m sure people are monetising ads in their Juce apps??

Thanks

Hey @dankly!

I just ran into issues with Firebase myself. OMG I wasted so many hours trying different combination of Header Search Path, Frameworks, XFrameworks, other Projucer/xCode evil things. But I finally got Firebase Analytics and Crashlytics to work on iOS. I suspect issue with Google Mobile Ads are most likely have similar causes.

Due to changed in recent Firebase iOS SDK (i.e. 9.5.0) - it uses now Swift binaries I didn’t find any way to link it properly and make some with Projucer. I went back on GH looking for older release of Firebase which doesn’t use Swift Binaries and it worked with 8.5.0!

Firebase 8.5.0 Release Firebase iOS 8.5.0 · firebase/firebase-ios-sdk · GitHub Release Firebase C++ SDK 8.5.0 · firebase/firebase-cpp-sdk · GitHub

I’ve updated my sample repo:

Hi, thanks for your help. I may be being stupid but there doesn’t seem to be any xcframeworks in the v8.5 cpp-sdk folder?!

My solution to similar issues with Firebase and other kinds of databases was to add a container in Google Cloud Run, or a cloud function that would be the only entity communicating with the database directly and forward whatever results back to the plugin.

That way, the plugin can just send plain https messages, which makes the cross platform build way simpler, and works easily on iOS too.

No worries. Firebase setup is too complicated. You need to download pre-build versions of the libraries.


@eyalamir Can you please elaborate on your approach?
Also I would love to turn Firebase into juce module… But I’m not sure how to approach it. I’ve created simple just modules before, but not something that has quite an extensive setup.

I’m currently running into issue when iOS Auv3 plugin doesn’t report Analytics even after confirming that Firebase was successfully initialized. Of course this issue is not present in Standalone build.

Yeah, sure.
Google has a service called “Cloud Run”

It lets you essentially run a docker container which will be launched and run for a short period of time whenever an http request happens. That container can run a node.js program, a C++ program, a Python program… whatever you want, on a Linux machine you configure with a dockerfile.

Then you set up a simple web server that answers HTTP requests that take some input and returns an output, and does all the heavy duty of talking to Firebase, SQL or whatever your database is.

Then the plugin/app only needs to make regular HTTPS requests (for example, using juce::URL) without any direct connection to the specific type of database, which you can in fact even change later without the plugin knowing about it.

TBH I tried it and the Firebase build system was too complicated and non-portable, which is why I went with the solution above, and never looked back. :slight_smile:

2 Likes

Thanks for detailed overview! Sounds like a great approach, plus prevents from future issues with dependency changes (i.e. Firebase moving to Swift binaries)

What do you use for Crash reporting of Auv3 plugins?

Not sure I’m the right person to get the tips on AUv3: we’re now in the process of working on the first commercial AUv3 I’ve ever done, so it’s possible I might not have all the answers.

But so far I just used the mechanisms that are built in the App Store (App Store Connect) to see crash logs and such from users, which was pretty helpful.

Gotcha! Thanks!

Great info from you both, thank you. I STILL can’t even get a single firebase framework (even the v8.5 ones) to copy into Xcode via that ‘Extra Custom Frameworks’ box. Ive added the search path, but as soon as Xcode loads up it is red in the framework list (and has the .xcframework extension). It works fine if I drag them direct into Xcode from the exact same location. The only way it will work (or at least seem to) is if I embed them from Projucer, but then that gives me the weird info.plist error in post 1. Im tearing my hair out with it!

Did you modified Projucer to work with *.xcframeworks"?
I think it’s a good idea to checkout my repo I posted above and see if you’re still getting same issues with that project.

Yes I did, but I think you may be correct in that this is where the problem lies. Ive changed that code in this path JUCE/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h but it doesn’t seem to be doing anything. In fact I’ve commented out a huge chunk of code in that header file and it isn’t doing anything, no errors or anything! The header is not copied into the project file either that I can see. Ill try start a new project with this edited header in place and see what happens. I feel like I’m on the right track though. Thanks.

I think my issue may be to do with ‘Build custom Projucer from source’, in your guide. If I just start a new project as I always do, nothing that I do to change those jucer_ProjectExport_Xcode.h makes any difference. If I modify those and then open the /Users/…/Documents/JUCE/extras/Projucer/Projucer.jucer the effects can be seen with errors etc. What is the purpose of that Projucer.jucer? Am I supposed to start a new project from that somehow?

Sorry I know I’m being an amateur but I’ve never had to do anything but start a new project from the standard Producer app icon in the top of the Juce directory.

jucer_ProjectExport_Xcode.h you need to edit is not part of juce_modules. It’s code for the app - Projucer. So you need to rebuild it and use if to open project you’re working on.

  1. Checkout juce repo
  2. If you’re on Mac - Go to extras/Projucer/Build/
  3. Open Xcode project Projucer.xcodeproj
  4. Edit jucer_ProjectExport_Xcode.h
  5. Build Projucer
  6. Use new Projucer.app to open your project with “.xcframeworks”

Deleted, apologies. I may have got it working. Will update soon.

That was painful, but I’ve sorted it. The issue I was having all along was as you said @dikadk13 , thanks for all your help. I didn’t realise that was the way the Projucer app was built and so when I edited the code, I was then still using the old Projucer app from my dock. You live and learn.

FYI, I have it working using the latest version of firebase (9.4). I don’t know if this will solve the problems you were having, but you need to add a blank .swift file to your source. I added it direct in Xcode (choose to add bridging header when asked) then that will save in your builds folder. Then back in Projucer/Source choose add existing file and select it.

1 Like