firebase-unity-sdk
firebase-unity-sdk copied to clipboard
AppOptions.LoadFromJsonConfig() not working correctly on iOS
Overview: I guess the function call might technically be working. However, whilst the Android google-services.json works fine for Android, it throws the following error on iOS: "ERROR: Unable to configure Firebase app (Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist or set in the customized options.)"
Additionally, there's no way of downloading a valid google-services.json for iOS, plus the GoogleService-info.plist uses different names and structure to the google-services.json.
Motivation: We need different firebase projects for development and live production environments so we can easily develop and test (f.ex) Remote Config structural changes without fear of breaking the game for our entire player base. In the longer term, we can envisage a use case for multiple firebase projects within the same game, so build-time substitution isn't a long-term solution.
Suggest a fix: In descending order, my for a fix preference would be:
- Expose "google-services.json" download for iOS through the console.
- Implement AppOptions.LoadFromPlistConfig()
- Document the mapping between plist & json
[Note that we're currently using Firebase Unity v6.6.0 - if this is fixed in a later version, then apologies in advance, although I checked the release notes and there was nothing listed there addressing this issue]
This issue does not seem to follow the issue template. Make sure you provide all the required information.
As you can see about AppOption.AppId, Android App and iOS App shares different App Id. Android App id usually looks like 1:1234567890123:android:1234567890abcdefghijkl
where iOS one usually looks like 1:1234567890123:ios:1234567890abcdefghijkl
.
Given that most of the other properties in AppOption are the same between google-services.json and GoogleService-Info.plist, for now, I think your best bet now is to manually change AppOption.AppId
using GOOGLE_APP_ID in GoogleService-Info.plist.
I don't think we will ever support google-services.json for iOS, at least not in the foreseeable future.
However, AppOptions.LoadFromPlistConfig()
is an interesting thought.
Also seems like both iOS and Android has some way to support multiple project files, however, it requires you to modify the Xcode/Android project Unity generated.
I can file a feature request. However, you can always specify each fields in AppOption
.
Hope this helps!
Thanks for the prompt response - that's basically the approach I've taken.
My main concern is that "most of the other properties" will inevitably lead to a "certain amount of uncertainty". There's additional data in the json that's not in the plist - specifically some oauth-client fields that I can only really guess at their meaning.
Is it possible to get a some more documentation about the configuration files themselves? I'm a big fan of "automate where possible", and knowing which fields are common plus the mappings between the formats, and most importantly where the delta lies would really help for reducing that uncertainty and building a "firebase-plist2json" CLI tool.
The "modify generated projects" is definitely less appealing to me; I've been bitten too many times in the past by toolchains changing underneath me (yes, I'm looking at you XCode), so would much prefer to bake this behaviour in at source level.