Firestore读取旧数据

时间:2018-06-30 22:46:52

标签: ios swift google-cloud-firestore

我已经从集合“卡”中删除了所有文档。但是我的旧数据一直在显示!我最近更新了Firebase吊舱。

这是我的阅读数据代码:

CARDS_REF.addSnapshotListener({ (snapshot, error) in
            if let error = error {
                debugPrint("ERROR WHILE FETCHING CARDS: \(error.localizedDescription)")
                return
            }

            var newCards = [Card]()
            guard let snaps = snapshot else { return }
            for snap in snaps.documents {
                let newCard = Card(key: snap.documentID, dictionary: snap.data() as [String: AnyObject])

                let timeStamp = newCard.expirationDate
                let expirationDate: Date = timeStamp!.dateValue()
                let currentDate = Date()

                if currentDate < expirationDate {
                   newCards.append(newCard)
                }
            }

            self.cards = newCards
            self.mainVC?.cardsLoaded()
        })

这里是CARDS_REF

let firestoreRef = Firestore.firestore() // <-- Declared outside of class
fileprivate var _CARDS_REF = firestoreRef.collection("cards") // <-- Declared inside DataService class

var CARDS_REF: CollectionReference { // <-- Declared inside DataService class
    return _CARDS_REF
}

有什么想法吗?谢谢!

1 个答案:

答案 0 :(得分:0)

Yea Firebase正在为您缓存数据。要禁用此功能,请执行以下操作:

Good word       Bad word
"acedía"        "acedia"
"aeróbic"       "aerobic"
"aeróstato"     "aerostato"
"afrodisíaco"   "afrodisiaco"
"alcalá"        "alcala"
"alvéolo"       "alveolo"
"alérgeno"      "alergeno"
"amoníaco"      "amoniaco"
"anémona"       "anemona"
"arcén"         "arcen"
相关问题