Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FirebaseRemoteConfig issue with Codable default config #14368

Open
markos92i opened this issue Jan 22, 2025 · 2 comments
Open

FirebaseRemoteConfig issue with Codable default config #14368

markos92i opened this issue Jan 22, 2025 · 2 comments
Assignees

Comments

@markos92i
Copy link

Description

Hi,
I just discovered a strange issue when setting a default config with a Codable containing a Date attribute to Firebase Remote Config on iOS.

What I thing its happening is: since Remote Config uses its own JSONEncoder internally it takes the Date and parses it using a unix format (ex: 666140400) while in Firebase Remote Config dashboard the dates in the JSON are in iso8601 format. So when my app tries to fetch the config from Firebase, if for some reason it fails or doesn't manage to retrieve the one online and has to resort to the default one, my code will fail to parse the returned data because im trying to decode an iso8601 date in my Codable, and the returned one is unix only in this particular case, even though the configs I set both locally and online have iso8601 dates.

I think a possible way of solving this would be if we could configure manually the encoding/decoding strategy that Firebase uses internally, to guarantee that the data format is consistent.

Meanwhile my workaround has been to transform my default config Codable to a Dictionary, using my own encoder configured for iso8601, and use the setDefaults method that accepts dictionaries as parameter instead.

Hope I managed to explain the issue clearly.

Thank you.

Reproducing the issue

No response

Firebase SDK Version

11.7.0

Xcode Version

16.2

Installation Method

Swift Package Manager

Firebase Product(s)

Remote Config

Targeted Platforms

iOS

Relevant Log Output

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@paulb777
Copy link
Member

@markos92i Thanks for the report. At first glance it looks clear to me. We'll add it to our backlog.

In the meantime, we'd be happy to review a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants