I've got a Firestore Collection I'm querying. I've confirmed that the query is working as expected by printing the contents of the documents its snapshot returns:
Optional([
"location": <FIRGeoPoint: (44.916159, -93.336624)>,
"foo": 1,
"bar": potato,
"someArray": <__NSArrayM 0x2826b8450>(
<FIRDocumentReference: 0x2828f58c0>,
<FIRDocumentReference: 0x2828f5900>
),
"owner": <FIRDocumentReference: 0x2828f5920>,
"timestamp": 2019-01-05 01:06:37 +0000
])
I am able to successfully get any value from the document except for the timestamp. I'm aware that there are some special behaviors with timestamps, but both of the following give me nil, despite the value clearly being present in the snapshot shown above.
guard let timestamp = documentSnapshot.get("timestamp") as? Timestamp else {
print("Couldn't get timestamp")
return
}
guard let timestamp = documentSnapshot.get("timestamp", serverTimestampBehavior: .estimate) as? Timestamp else {
print("Couldn't get timestamp")
return
}
For the hell of it, I also tried this, to no avail
guard let timestamp = documentSnapshot.get("timestamp") as? String else {
print("Couldn't get timestamp")
return
}
Any idea why I can get every value from the document except for the Timestamp?
(Swift 4.2 with Firebase iOS SDK 5.15.0)