负面的时间戳得到错误的post列表

我被困在一个棘手的小问题上,所以请帮助

(此代码有效)我使用下面的代码来获取最新的post,使用negativeTimestamp:哪个是使用FIRServer,然后查询和负面。

FIRDatabase.database().reference().child("post").child(animal).queryOrdered(byChild: "negativeStamp").queryEnding(atValue: startValue - 1, childKey: "negativeStamp").observe(.childAdded, with: {(snapshot) in 

我也使用下面的查询来获得所有的post, 这完美的作品 。 我最终得到最新的项目。

 ref.child("post").child(animal).queryOrdered(byChild: "negativeStamp").queryLimited(toFirst: 5).observeSingleEvent(of: .value, with: {(snapshot) in 

当我尝试获取tableView的接下来的5个元素时,问题就出现了。 我无法顺序查询5个元素? 我正在使用这个代码。 Self.timestampArray.last将是tableView中显示的最后一个post。

 let endingValue: Int = self.timestampArray.last! let timeIntervalToday: TimeInterval = (NSDate().timeIntervalSince1970) * -1 FIRDatabase.database().reference().child("post").child(animal).queryOrdered(byChild: "negativeStamp").queryEnding(atValue: (endingValue + 1)).observe(.value, with: {(snapshot) in 

我也使用这个tableView函数来知道用户何时到达底部 。 希望这不是太多的阅读。

 func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { print("current index: \(indexPath.row)") if (indexPath.row != 0 && self.imageArray.count != 0) { if (indexPath.row == self.imageArray.count - 1) { print("Equal partners") print("Hsbbs: \(imageArr)") self.queryMorePost() } } }