Firebase Messaging not working without GoogleServices-Info.plist - ios

I was under the impression that GoogleServices-Info.plist is not mandatory anymore since FlutterFire CLI nicely puts config files on dart code, like firebase_options_flavor1.dart
App was working without GoogleServices-Info.plist but after adding Firebase Messaging, it started to crash without this file.
My questions are:
Is GoogleServices-Info.plist still required?
If yes, is it possible to add firebase config remotely? With dart, it's easy. But it's hard to inject in native code.
Some relevant messages on Github.
Comment that exactly describes my problem: https://github.com/firebase/flutterfire/issues/8119#issuecomment-1048738598
Issue where dart initialization crashes with notifications: https://github.com/firebase/flutterfire/issues/7752
Comment where dart-only initialization not working: https://github.com/firebase/flutterfire/issues/8119#issuecomment-1047823455

The issue with Firebase Messaging and the GoogleServices-Info.plist file is a known issue, and it has been reported on the FlutterFire GitHub repository or somewhere in internet.
GoogleServices-Info.plist is still required for Firebase to work properly in your app. This file contains important configuration information for your Firebase project, including your app's bundle ID and API key.
While it is possible to add Firebase configuration remotely using Dart code, this approach is not recommended for security reasons.
The recommended approach is to include the GoogleServices-Info.plist file in your project, and then let Firebase read the configuration information from this file.
The issue is caused by a conflict between the Firebase Messaging plugin and the GoogleServices-Info.plist file, and it can be resolved by either removing the GoogleServices-Info.plist file or updating the Firebase Messaging plugin to the latest version.
Regarding the comment you mentioned, it is true that Firebase initialization can sometimes fail when using Dart-only initialization, especially when it comes to Firebase Cloud Messaging. In this case, it is recommended to use native initialization instead, as it is more reliable and less error-prone.

Related

Can you add Google Analytics inside a Swift Package independante from the Overall Project?

I am trying to add Google Analytics inside of a Swift Package that is independent from the app that is containing the package. The problem I am having right now is that the app crashes when I envoke the package with an error stating:
FirebaseApp.configure() could not find a valid GoogleService-Info.plist
As you can see the Google Services exists inside the package. Happy to provide additional details, I'm not sure what would be useful though (or if this is even possible)

Why does flutterfire configure not replace my old GoogleService-Info.plist file?

When I first run flutterfire configure in my flutter app, 4 files were generated. firebase_options.dart, google-services.json, firebase_app_id_file.json and GoogleServices-Info.plist.
When I tried to use flutterfire configure again to link my app to a development version of my app (following this thread), I was only prompted to change 3 of the files like this:
The google-services.json file already exists but for a different Firebase project (betacentre-dev). Do you want to replace it with Firebase project thinking-digit-343408? ยท yes
After selecting yes for all of them, only GoogleService-Info.plist was unchanged, yet it is clearly crucial for firebase to work (since flutterfire configure added it in the first place, and it is referenced in this guide and also this guide, and it contains identifiers for my firebase project, and my app still communicates with the original project).
Is this a bug? Why is it behaving this way?

Firebase storage download trouble in iOS device (Unity)

I met unknown trouble trying to setup firebase storage for iOS. I can't download even 1 file in device, but it runs perfectly in Editor.
I am using reference.GetFileAsync() method. Firstly I assumed that I made some wrong package setup or some other silly mistake, but I checked it many-many times. Each Quickstart project here works well on my end. My current project settings and firebase storage settings are identical to provided test examples I run in iOS device successfully.
Here is a xCode output trying to download the file. That is looped and contains only that info: codeshare
Any of logs googling doesn't give me any solution or even idea.
Please, give me some thoughts where to search the problem.. I am totally confused.
I am using MacOSx, Unity 5.5.0/5.5.1, latest Firebase Unity SDK (v1.1.2)
The reason was that firebase database package automatically changed from .NET Subset to .NET option. Changing back solved the problem. But anyway, that means we can't use firebase storage + database in same iOS project in Unity.. That's bad
Firebase Developer here. I'm sorry you encountered this error and I can confirm this was a regression from our initial build in January. This issue has since been resolved in the latest version of Firebase Storage for Unity (3.0.0.0) released for general availability for mobile at GDC.
The latest version will work with the full .Net SDK which is also required for the realtime database in Unity.

Could not configure Firebase InstanceID

hi I'm trying to include firebase in my app and followed the documentation, when I'm trying to do google sign in, Could not configure Firebase InstanceID error occurs .please advice how to overcome this error
There are two things to check (and hopefully, one will fix it for you):
Make sure your BundleIdentifier is exactly the same in your Firebase project as it is in your Xcode, i.e. com.[yourcompany].[yourappname]
Make sure you got the latest GoogleService-Info.plist file. Go to Firebase Console -> Settings -> Your Application - there will be a blue button to the right that lets you download new configuration file
That solved it for me.
Bug Details
As of version 3.13.0, there appears to be a bug in the Firebase/Core SDK.
I added a symbolic breakpoint at -[FIRInstanceID(FIRApp) configureInstanceIDWithOptions:app:] and stepped though the assembly.
It appears that FIRApp.configure() is ignoring the IS_GCM_ENABLED flag in the GoogleServices-Info.plist and tries to configure GCM regardless of the flag's state. In my case, because my project does not use GCM, the app would crash because there was no GCM_SENDER_ID in the plist.
Workaround
Add a dummy value (i.e. 123456789012) for GCM_SENDER_ID within the GoogleService-Info.plist file. This will allow the application to configure successfully.
You have to add your project which is created on
https://developers.google.com/mobile/add?platform=ios or fire base console into your Firebase dashboard.
Now you can download GoogleService-Info.plist from Firebase and import into your project.
I setup Firebase in code using FIROptions. In my case, I was missing gcmSenderID, fixing it then it works
Firebase DevRel here. This should be an error, unless you enabled gcm, you shouldn't go through instanceid setup. Filed internally.
For now, the workaround is manually changing "IS_GCM_ENABLED" to "NO" in your "GoogleService-Info.plist" file
I was getting this error as I didn't have my GoogleService-Info.plist in my Test folder as well. ( if you are using TDD)
As of the latest Firebase Core 3.16.0 - I seem to need to include it in my main project as well as copying a version into my Test Root.
This also happens when you shift your google SDK integration from one account to another and don't edit the API keys on application side.Make sure when you shift from one google account to another, you re-visit all the SDK guides again like FCM, Google Sign-in etc and make sure you are using new API keys (client_id, URI Scheme) in application.

Google Clould Messaging (iOS) put files in default app Documents folder

I would like to turn on UIFileSharingEnabled to let users of my app save some files in their pc.
The problem is that a Google library is putting files inside the main Documents folder of my app without letting me specify a different destination.
This way, if I turn on UIFileSharingEnabled, this is what the user can see and interact with (download or delete!)
The 3 folders are mine, so I can move them out easily, but the 3 .plist files are a problem. I cannot move them without breaking google functionalities.
I use Cocoapods for loading them inside my project.
pod 'Google/Analytics', '1.0.7'
pod 'Google/CloudMessaging', '1.0.7'
Any idea on how to fix this? I'm stuck in this situation.
Thanks
UPDATE: This issue is finally fixed in Firebase version 3.4 from 1 Aug 2016: "plist files used by FIRMessaging are now stored in an ApplicationSupport directory." (source)
Six months later I have the same problem. It turned out GCM developers have failed to fix this bug. I opened another issue (here) and they confirmed this is not fixed yet. In the meantime Google have announced Firebase Cloud Messaging will inherit GCM. I removed GCM form my app and integrated Firebase. However the issue is still reproducible. These four files are created upon app launch:
com.google.iid-keypair.plist
com.google.iid-tokens.plist
g-checkin.plist
rmq2.sqlite
I've logged a bug request to Firebase support. I'll update my answer when I see this issue fixed.
Till then I do not recommend to use Firebase Messaging in an iOS application. Your app may be rejected from the App Store for writing temp files to Documents directory.
Just so you know, I reported the issue on github.
https://github.com/google/gcm/issues/120
Yesterday a Google guy said it will be fixed in the next version! Yeah!

Resources