我正在尝试在注册时检查用户是否已在我的应用中注册。对于每个成功的注册,我都会在LoginViewcontroller
url 中获得一个 UID,并将该 UID 保存在钥匙串包装器中。我正在检索RegistrationViewController
regesterservice 中的 UID 值,但是当我尝试检查该 UID 时,我一直在获取nil
。为什么..?如何检查用户是否已经注册?请帮我。
在LoginViewcontroller
登录服务中,我像这样保存 UID 值:
self.Uid = json["id"] as? String
KeychainWrapper.standard.set(emailL ?? "", forKey: "user_email")
KeychainWrapper.standard.set(self.Uid!, forKey: "Uid")
在这里,在 中RegisterViewController
,我检索 UID 值。但是对于已经注册的人,我在 UID 中也得到了“零”。为什么?
do {
let userId: String? = KeychainWrapper.standard.string(forKey: "Uid")
print("login userid \(userId)")
if userId != nil{
AlertFun.ShowAlert(title: "Title", message: "user exist", in: self)
} else {
let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as! [String: Any]
print("go to otp service!!!")
self.otpField = json["otp"] as? Int
}
} catch {
print("error")
}
如何查询已注册人员的 UID?