简体   繁体   English

如何获得Firebase用户uuid

[英]How to get Firebase user uuid

有什么方法可以在用户注销时获取Firebase用户uuid ,但至少以匿名身份登录一次?也许可以从钥匙串访问或Firebase userDefaults获取uuid

You can only get the UID if there is a current [FIRAuth auth].currentUser . 如果有当前[FIRAuth auth].currentUser则只能获取UID。 Any other 'hacky' method to try and retrieve this would not be recommended. 不建议使用任何其他'hacky'方法来尝试检索它。

If you wanted to get this after they had logged out you could save this into UserDefaults or the keychain yourself while they are logged in. 如果你想在注销后得到这个,你可以在登录时将其保存到UserDefaults或自己的钥匙串中。

You can get it by: 你可以通过以下方式获得:

FIRUser *user = [FIRAuth auth].currentUser;
if (user) {
  NSString *uid = user.uid;
}

Hope this help. 希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM