目前,我正在开发与Firebase数据库通信的Ionic2应用程序。在更新节点时,有时它起作用,有时却不起作用。
所以我厌倦了使用以下代码来处理错误:
this.db.list("/Events/" + this.eventID+ "/teilnehmer").push(this.userID)
.then(resolve => {
console.log('success');
}, reject => {
console.log('error');
})
.catch(reject => {
console.log('catch');
});
但是,即使我断开了互联网连接,也不会引发任何错误。
你们当中有人知道如果推送不成功怎么办?
最佳答案
我也遇到过这样的情况,即推送有时无法返回 promise ,因此我在github FirebaseListObservable push() takes too long to add上提出了问题,但不幸的是没有解决,我通过电子邮件联系了Firebase支持,支持团队检查了我的问题并检查了我发送的代码,并在那儿回答与代码无关,建议我清除手机的存储缓存,我也这样做了,并且问题得到解决,
这是来自Firebase支持的邮件
Hi xxxx,
I suggest that you try clearing your phone's cache before proceeding again, its memory might be too high. To do this, go to: Settings -> Storage -> Cached Data. Select it then then choose ok (for clearing the cache). Also please check this the same issue raised on Github and answered by one of our engineers.
If the issue persists after trying the proposed suggestions, please get back to me with a minimal and runnable code that we can use to simulate this, possibly a plunkr or jsfiddle code, or a from the scratch code that can demonstrate the issue.
Regards, xxxx
关于error-handling - 检查推送是否成功-angularfire2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43835548/