잡다한 교훈

2021-10-19 Android 어플과 Realtime Database

콘요맘떼 2021. 10. 19. 15:27

https://rnfirebase.io/database/usage

 

Realtime Database | React Native Firebase

Copyright © 2017-2020 Invertase Limited. Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. Some partial documentation, under the

rnfirebase.io

필요 작업을 모두 수행했음에도 불구하고 Realtime DB 처리가 되지 않는 문제가 발생하였을 때

 

원인

(1) 규칙 : Rules를 읽기 쓰기 모두 접근이 가능하게 바꿔준다.

(2) google-services.json : Firebase 콘솔을 통해 해당 파일을 다운로드 받은 이후에 DB를 형성하게 되면 뒤늦게 만든 DB에 접근이 제대로 이루어지지 않는다. 따라서 콘솔을 통해 다시 google-services.json 파일을 다운로드한 후 갱신된 파일을  android/app 폴더 내에 넣어주는 작업이 필요하다.

(3) 이상하게 .ref('/user')와 같은 형태로는 답변이 오지 않는데 .ref().child('users')로 대체한 경우에는 정상적으로 작동했다. 둘의 차이가 뭔지는 조금 더 공부를 해봐야겠다.