我使用 firebase 实时数据库来保存我的游戏数据。当没有互联网并且我尝试发送 JSON 数据时,它经常给我内部错误。它似乎无休止地尝试发送数据,但我只调用了一次。这会导致控制台内出现错误日志垃圾。
FirebaseDatabase.DefaultInstance.RootReference
.Child("users")
.Child(GetUserID())
.SetRawJsonValueAsync(json)
.ContinueWith(task => {
if (task.Exception != null || task.IsCanceled || task.IsFaulted) {
Debug.LogError("FirebaseStorageService - Upload User Data - FAILED!");
} else {
Debug.Log("FirebaseStorageService - Upload User Data - DONE");
}
});
我希望进入传递给 ContinueWith 的回调方法并能够在那里处理异常。我应该拥有的似乎是“task.Exception”。我也不能来那个街区。
我反复收到的错误消息:
09-13 11:50:51.777 30555 31681 E Unity : 09/13/2018 08:50:51 [Error] WebSocket: ws_5 - WebSocketException during handshake
09-13 11:50:51.777 30555 31681 E Unity : Firebase.Database.Internal.TubeSock.WebSocketException: unknown host: cooking-game-88ssd.firebaseio.com ---> System.Net.Sockets.SocketException: No such host is known
09-13 11:50:51.777 30555 31681 E Unity : at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0
09-13 11:50:51.777 30555 31681 E Unity : at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0
09-13 11:50:51.777 30555 31681 E Unity : at Firebase.Database.Internal.TubeSock.WebSocket.GetIpAddress (System.String hostName) [0x00000] in <filename unknown>:0
09-13 11:50:51.777 30555 31681 E Unity : --- End of inner exception stack trace ---
09-13 11:50:51.777 30555 31681 E Unity : at Firebase.Database.Internal.TubeSock.WebSocket.CreateSocket () [0x00000] in <filename unknown>:0
09-13 11:50:51.777 30555 31681 E Unity : at Firebase.Database.Internal.TubeSock.WebSocket.RunReader () [0x00000] in <filename unknown>:0
更新 1: 我刚刚发现这不仅仅是发送或检索。即使有以下声明,我也收到了这些信息:
DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;
更新 2:
Firebase 4.2 版
慕森卡
GCT1015
相关分类