How do you create a field of type storage reference in the swift dictionary format using swift. I keep on getting an error saying that FIRStorageReference. Thank you in advance for your help. This is the code below, photoRef is a storage reference:
let newFirePhotoRef = newUserRef.collection("Photos").document()
photoRef = photoRef.child(newFirePhotoRef.documentID)
newFirePhotoRef.setData([
"Date":Date(),
"Photo Reference in Storage": photoRef
])
This is the error I receive:
Terminating app due to uncaught exception 'FIRInvalidArgumentException', reason: 'Unsupported type: FIRStorageReference (found in field Photo Reference in Storage
)'
You can't store objects of type FIRStorageReference in Firestore. Instead, convert the FIRStorageReference object to a string, and store the string. You could use some combination of bucket and fullPath to build a string that suits your needs.