Terminating app due to uncaught exception 'FIRInvalidArgumentException', reason: 'Unsupported type: _SwiftValue'
I' trying to create or update document in Firestore and getting that error.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
let docData: [String: Any] = [
"firebase_buyer_id": "222", // todo - set buyer id correctly
"firebase_seller_id": "String(describing: self!.ad.ownerId)",
"reference_object": [
"reference_object_id": "testing_id",
"last_updated_time": Timestamp(date: Date()),
"chat_item_list": [
{
[
"chat_id": "12", // set chat id
"owner_id": "222",
"time_stamp": Timestamp(date: Date()),
"message": "testing message - hi, message send successfully"
]
}
]
]
]
self!.db.collection((self?.collectionName)!).document((self?.refId)!).setData(docData){ err in
if let err = err {
print("Error writing document: \(err)")
} else {
print("Document successfully written!")
}
}
})