What I am doing
I am trying to send data through textfield to the database of Firebase to make sure whether both xcode and firebase are connected.
The question to solve
2018-06-28 13:42:02.795922+0900 SNS[7542:1313616] 5.0.0 - [Firebase/Database][I-RDB038012] setValue: or removeValue: at /list/-LG3gfosEPzRUA2nGQM7 failed: permission_denied
Debug area always returns this result after clicking "Add" button . It seems like firebase denies this processing. But I still haven't been able to find a solution for this although I figured out and tried out as many ideas as I could come up with.
I want to know how to get a permission from Firebase to save data in it
Or if there is something problem that you can find from the information of this project down below, I would like you to indicate.
Development environment
- IDE: Xcode
- Language: swift 4.0.3
- Database: Firebase
View Controller code
import UIKit
import Firebase
class ViewController: UIViewController {
@IBOutlet weak var TextField: UITextField!
var ref: DatabaseReference?
@IBAction func Add(_ sender: Any) {
ref = Database.database().reference()
if TextField.text != "" {
let data = ["name": TextField.text!]
ref?.child("list").childByAutoId().setValue(data)
TextField.text! = ""
}
}
The project situation
Security rule
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write;
}
}
}
Probably, I don't think I have to be changing this.
GoogleService-Info.plist
I made sure this file was added to the navigator area of xcode and the file was downloaded when making the project.
Setting initialization code on AppDelegate file
FIRApp.configure() has already been set on APPDelegate file.
Others
The same questions I found on stackoverflow were indicated about a code of Security Rules by questions but now the change of security rules became more intuitive handling like you can roughly select allowability of writing and reading by radio buttons between "lock mode" and "test mode" so I checked the "test mode" but Firebase still haven't opened its permission.
0 Answer(s)