4

This is the error in the console

Unable to get latest value for query FQuerySpec (path: /Oeuvres/13, params: { }), client offline with no active listeners and no matching disk cache entries

[Firebase/Database][I-RDB082010] Got data message: { b = { d = "Permission denied"; s = "permission_denied"; }; r = 3; }

When I run my code

var ref: DatabaseReference!

    ref = Database.database().reference()

    ref.child("Oeuvres").child(id).getData(completion:  { error, snapshot in

      guard error == nil else {
        print("\(error!.localizedDescription)")
        return;
      }
        print(snapshot.value)
    });

Here's my rules on firebase realtime database

{
  "rules": {
      ".read": true,
      ".write": "auth !== null"
  }
} 

Anyone can help me please ?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
IopzIOS
  • 41
  • 1
  • 1
    There's nothing wrong with the code in the question but we don't know what the `id` var resolves to and whether or not you're authenticated. Please update the question with details. Also, there's no reason to `guard` the error as you won't be using it after that. `if let error = error` is probably a better option. – Jay Feb 26 '22 at 14:35
  • I had a similar issue, but was finally able to solve it after reading the full error lol. In my case, since I was using sorting/filtering queries prior to my `.getData()`, I needed to add the appropriate indexes in my Rules. – Eric33187 Mar 22 '22 at 00:34

0 Answers0