首页 > 解决方案 > 更改谷歌帐户后反应本机firestore不上传数据

问题描述

我使用 firestore 和 react-native 制作了一个应用程序,它运行良好。我最近决定更改创建应用程序时使用的 google 帐户,并使用新凭据更新了 google-services.json,但是现在它停止工作了。

firestore().collection(''+now.getFullYear()+''+(now.getMonth()+1))
        .doc(''+now.getDate()+''+now.getHours()+''+now.getMinutes()+''+now.getSeconds()).set(
          {
            time: Date(),
            point: blob
          }
        ).then(()=>{
          console.log('Uploaded data')
          status('Uploaded')
        })

这是我添加数据的代码,.then 函数运行并返回上传的数据,但是在 firebase 控制台上没有添加数据。

我该如何进行调试并找到确切的问题?或者有人可以指出我是否在某处犯了错误,谢谢

标签: javascriptfirebasereact-nativegoogle-cloud-firestore

解决方案


可以尝试添加

.catch(error => {
console.log(error)
})

所以它会是

firestore().collection(''+now.getFullYear()+''+(now.getMonth()+1))
        .doc(''+now.getDate()+''+now.getHours()+''+now.getMinutes()+''+now.getSeconds()).set(
          {
            time: Date(),
            point: blob
          }
        ).then(()=>{
          console.log('Uploaded data')
          status('Uploaded')
        }).catch(error => {
    console.log(error)
    })

推荐阅读