iOS应用程序运行良好,可以访问firebase数据库,但Catalyst应用程序出现以下错误:
6.11.0 - [Firebase/Database][I-RDB038012] Listener at /my_database/path failed: permission_denied
我在firebase控制台中创建了一个与Catalyst应用程序具有相同bundleID的应用程序,并下载了并将GoogleService-info.plist
包含在项目中。
更新:路径的firebase规则如下。请注意,iOS应用程序运行良好,可以访问此数据库;只有Catalyst版本的权限被拒绝。
".read": "auth != null",
".write": "auth != null"
读取数据库的Swift(在iOS上工作时没有错误(:
Auth.auth().signIn(withEmail: RandomUser().randomUser, password: Constants.FIREBASE_P) { (user, error) in
let databasePath = "my_database/battery_pdf/(model)/odometer_values"
let ref = Database.database().reference(withPath: databasePath)
ref.observeSingleEvent(of: .value, with: { (snapshot) in
...
}
}
我添加了"钥匙链共享"作为一种功能,错误消失了。该应用程序根本不使用钥匙串,所以这是一个奇怪的要求。
我希望这能帮助到别人。