firebase查询问题

时间:2017-07-14 14:38:12

标签: swift firebase firebase-realtime-database swift2

我的查询:

let query = recentRef.queryOrderedByChild(FRECENT_GROUPID).queryEqualToValue(group_id)
query.observeSingleEventOfType(.Value, withBlock: { snapshot in

数据库结构是:

enter image description here

我的查询如下:

(/Recent {
    ep = fb343534ca520c70fe35b0a316ea8e4c;
    i = groupId;
    sp = fb343534ca520c70fe35b0a316ea8e4c;
})

并在Snap (Recent) <null>时获得print(snapshot)

奇怪的是,它工作正常,但现在突然停止工作了。

修改

完成JSON:

{


 "Message" : {
    "fb343534ca520c70fe35b0a316ea8e4c" : {
      "-Kp0jed1EZ5BLllL5_cm" : {
        "createdAt" : 1.500046597341153E9,
        "groupId" : "fb343534ca520c70fe35b0a316ea8e4c",
        "objectId" : "-Kp0jed1EZ5BLllL5_cl",
        "senderId" : "lI6SRppSboScWo5xVjcfLL82Ogr2",
        "senderName" : "Test1 Test1",
        "status" : "",
        "text" : "hi",
        "type" : "text",
        "updatedAt" : 1.50004659734136E9
      }
    }
  },
  "Recent" : {
    "-Kp0jecwejhzQbbm62CW" : {
      "counter" : 0,
      "createdAt" : 1.500046600967624E9,
      "description" : "Test1 Test1",
      "groupId" : "fb343534ca520c70fe35b0a316ea8e4c",
      "lastMessage" : "hi",
      "members" : [ "lI6SRppSboScWo5xVjcfLL82Ogr2", "fnRvHFpaoDhXqM1se7NoTSiWZIZ2" ],
      "objectId" : "-Kp0jecwejhzQbbm62CV",
      "picture" : "",
      "type" : "private",
      "updatedAt" : 1.500046600967647E9,
      "userId" : "fnRvHFpaoDhXqM1se7NoTSiWZIZ2"
    },
    "-Kp0jed-FU1PXt1iPr29" : {
      "counter" : 0,
      "createdAt" : 1.500046600971885E9,
      "description" : "Srikant Root",
      "groupId" : "fb343534ca520c70fe35b0a316ea8e4c",
      "lastMessage" : "hi",
      "members" : [ "lI6SRppSboScWo5xVjcfLL82Ogr2", "fnRvHFpaoDhXqM1se7NoTSiWZIZ2" ],
      "objectId" : "-Kp0jed-FU1PXt1iPr28",
      "picture" : "https://s3.amazonaws.com/top500golfdev/uploads/profile/srikant.yadav@rootinfosol.com/profilepicture.jpg",
      "type" : "private",
      "updatedAt" : 1.500046600971896E9,
      "userId" : "lI6SRppSboScWo5xVjcfLL82Ogr2"
    }
  },
  "User" : {
    "fnRvHFpaoDhXqM1se7NoTSiWZIZ2" : {
      "createdAt" : 1.500045753102713E9,
      "email" : "srikant.yadav@rootinfosol.com",
      "firstname" : "Srikant",
      "fullname" : "Srikant Yadav",
      "handle" : "Srikant",
      "lastname" : "Yadav",
      "networkImage" : "https://s3.amazonaws.com/top500golfdev/uploads/profile/srikant.yadav@rootinfosol.com/profilepicture.jpg",
      "objectId" : "fnRvHFpaoDhXqM1se7NoTSiWZIZ2",
      "online" : false,
      "updatedAt" : 1.500045753102731E9
    },
    "lI6SRppSboScWo5xVjcfLL82Ogr2" : {
      "createdAt" : 1.500045791892967E9,
      "email" : "test1@gmail.com",
      "firstname" : "Test1",
      "fullname" : "Test1 Test1",
      "handle" : "test1",
      "lastname" : "Test1",
      "networkImage" : "",
      "objectId" : "lI6SRppSboScWo5xVjcfLL82Ogr2",
      "online" : false,
      "updatedAt" : 1.500046571456235E9
    }
  }
}

0 个答案:

没有答案