这是我的删除用户方法….
FIRAuth.auth()?.signIn(withEmail: (emailTextFIEld?.text)!,password: (passwordTextFIEld?.text)!,completion: { (user,error) in if error == nil { print("User Authenticate!!!") let user = FIRAuth.auth()?.currentUser user?.delete(completion: { (error) in if error != nil { print("Error unable to delete user") } else { DataService.ds.deleteCurrentFirebaseDBUser() KeychainWrapper.standard.removeObject(forKey: KEY_UID) self.performSegue(withIDentifIEr: "goTologin",sender: nil) } }) } else { //Password was wrong,unable to authenicate user. Data is not updated print("!!!ALERT!!! Unable to authenticate user") let alert = UIAlertController(Title: "Incorrect Password",message: "Please re-enter your password",preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(Title: "OK",style: UIAlertActionStyle.default,handler: nil)) self.present(alert,animated: true,completion: nil) } })
Firebase规则:
{"rules": { "users": { "$uID": { ".read": "$uID === auth.uID",".write": "$uID === auth.uID" } } }}
数据库:
App -> users -> 4erkjkl543jfe46 ->name ->email
错误:
2017-01-21 21:33:10.321704 APP [11582:4102711] [FirebaseDatabase] setValue:或removeValue:at / users / 4erkjkl543jfe46 Failed:permission_denIEd
可选(错误域= com.firebase代码= 1“权限被拒绝”UserInfo = {NSLocalizedDescription =权限被拒绝})
解决方法 我有同样的问题.您无法使用函数deleteCurrentFirebaseDBUser(),因为Firebase删除功能(如果成功)会删除用户身份验证对象.因此,当您要使用deleteCurrentFirebaseDBUser()删除数据库中的用户数据时,用户不再进行身份验证.
目前我在Firebase删除功能之前删除了数据库中的用户数据,这不是理想的解决方案.
总结以上是内存溢出为你收集整理的iOS SWIFT:无法从Firebase数据库中删除用户全部内容,希望文章能够帮你解决iOS SWIFT:无法从Firebase数据库中删除用户所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)