Value of type 'AuthDataResult' has no member 'uid'

岁酱吖の 提交于 2019-12-04 19:23:27

Try using:

if let user = Auth.auth().currentUser, let uid = user?.uid {
                    KeychainWrapper.standard.set((uid), forKey: "uid")
                    self.performSegue(withIdentifier: "toFeed", sender: nil)
                }

Try using with the guard statement to unwrap optionals safely. Give it a try!

guard let uid = user?.uid else { return }
KeychainWrapper.standard.set((uid), forKey: "uid")
self.performSegue(withIdentifier: "toFeed", sender: nil)

or

guard let uid = Auth.auth().currentUser?.uid else { return }
KeychainWrapper.standard.set((uid), forKey: "uid")
self.performSegue(withIdentifier: "toFeed", sender: nil)

I hope this helps you..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!