NativeScript / firebase

Modular Firebase 🔥 implementation for NativeScript. Supports both iOS & Android platforms for all Firebase services.
https://docs.nativescript.org/plugins/firebase-core.html
Apache License 2.0
56 stars 50 forks source link

[firebase-database][iOS] attempt to insert nil object from objects[0] #105

Closed danouche93 closed 2 years ago

danouche93 commented 2 years ago

Hi, I use this new plugin of firebase because the old one is deprecated. Thank you for developing this ! I open this ticket because I have an issue when setting a value in Firebase Database. When the object I send has one or more properties that are null, I get the error ERROR Error: Uncaught (in promise): Error: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0] and the object is not send. This issue only occurs in iOS. In Android it is working fine, whenever there are null properties, it is not sent to the database, it would be great to have the same behavior. I use NativeScript with Angular.

Nativescript : 8.2.3 Package.json

{
  "name": "TinaAppV2",
  "main": "./src/main.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.2.0",
    "@angular/common": "~13.2.0",
    "@angular/compiler": "~13.2.0",
    "@angular/core": "~13.2.0",
    "@angular/forms": "~13.2.0",
    "@angular/platform-browser": "~13.2.0",
    "@angular/platform-browser-dynamic": "~13.2.0",
    "@angular/router": "~13.2.0",
    "@nativescript-community/ui-pulltorefresh": "^2.5.1",
    "@nativescript/angular": "^13.0.0",
    "@nativescript/core": "~8.2.2",
    "@nativescript/datetimepicker": "^2.1.9",
    "@nativescript/firebase-core": "^2.1.0",
    "@nativescript/firebase-crashlytics": "^2.1.0",
    "@nativescript/firebase-database": "^2.1.0",
    "@nativescript/firebase-messaging": "^2.1.0",
    "@nativescript/geolocation": "^8.0.2",
    "@nativescript/mlkit-barcode-scanning": "^1.0.5",
    "@nativescript/mlkit-core": "^1.0.5",
    "@nativescript/theme": "~3.0.2",
    "@nstudio/nativescript-checkbox": "^2.0.5",
    "@nstudio/nativescript-floatingactionbutton": "^3.0.4",
    "nativescript-forgm-sound": "^1.1.3",
    "nativescript-ui-chart": "^9.0.2",
    "nativescript-ui-sidedrawer": "^10.0.2",
    "rxjs": "~7.5.0",
    "zone.js": "~0.11.5"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.3.6",
    "@angular/compiler-cli": "~13.2.0",
    "@nativescript/android": "8.2.2",
    "@nativescript/ios": "8.2.3",
    "@nativescript/types": "~8.2.0",
    "@nativescript/webpack": "~5.0.6",
    "@ngtools/webpack": "~13.2.0",
    "typescript": "~4.5.5"
  }
}
danouche93 commented 2 years ago

Thank you for releasing an update for this. Unfortunately I still have the issue :( @triniwiz

triniwiz commented 2 years ago

Can you send me some sample data

danouche93 commented 2 years ago

The object I sent to firebase is the value I get from my API. I've noticed it happens when the null value is in a list like : var obj = { "list": [{ "propertyA": "valueA", "propertyB": null }, { "propertyA": "aaa", "propertyB": null }] }; firebase().database().ref(path).set(obj);