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

iOS RTDB inconsistencies #667

Open
henkehagstrom opened this issue Nov 8, 2024 · 0 comments
Open

iOS RTDB inconsistencies #667

henkehagstrom opened this issue Nov 8, 2024 · 0 comments

Comments

@henkehagstrom
Copy link

henkehagstrom commented Nov 8, 2024

Hey

I just want to let you know about two bugs(?) I have found in this SDK.

  1. When writing a boolean from Android to RTDB, it comes out as expected ("true" or "false")
    But when writing it from iOS is comes out as Long in the database (1 or 0).

It seems like some devices manages to parse this correctly, while others do not, hence why I'm getting alot of this crash:

Fatal Exception: P3.c: Failed to convert value of type java.lang.Long to boolean
       at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.convertBoolean(CustomClassMapper.java:417)
       at 

 ...
  1. When reading an empty node in RTDB on iOS, the database snapshot value comes out as "<n.ull>" (without the dot). So when trying to parse this into an object using any Serializer it fails, and I get the default value of that object instead.

My workaround is currently to do this :

databaseRef.valueEvents.collect { snapshot ->
    val valueString = snapshot.value.toString()
    if(snapshot.value != null && valueString != "<null>") {
   ...

Android works as expected regarding this.

I am surprised no one else has had this issue, atleast I have not managed to find an issue here.

Kind regards!

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

No branches or pull requests

1 participant