Making an app in SwiftUI for iOS. However, when I try to read or write to firebase firestore, I keep receiving an insufficient permissions error. When I try to search up solutions to this error, people are saying to check the rules, but my rules are very open and configured as such:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
Here is the code trying to write into Firestore:
class MapViewModel: ObservableObject {
func fetchData() {
let db = Firestore.firestore()
db.document("another/pleaseWork").setData([
"name": "Working Man",
"age": 18,
])
}
}
What is interesting is that I can read and write from Firebase firestore emulator, but I cannot do the same with my actual project. Since I am currently using Firebase auth emulator for authentification, is it possible that Firebase does not allow you to use the emulator for auth while also using the actual project for reading/writing to firestore, even though my rules are so open?
Varun Vaidya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.