I am trying to check if user is already registered or not in my app while registration. for first time for every successful registration i am getting uid in LoginViewcontroller url and i am saving that uid in keychainWrapper. and i am retrieving uid value in RegistrationViewController regesterservice But when i am trying to check that uid i am getting nil all the time why?.. how to check if user is already registred or not. please help me in the code.
In LoginViewcintroller loginnservice i am saving uid value:
var Uid = json["id"] as? String
KeychainWrapper.standard.set(emailL ?? "", forKey: "user_email")
KeychainWrapper.standard.set(self.Uid!, forKey: "Uid")
here in RegisterViewController registerservice retrieving uid value and for already reagistred person also getting nil in uid.. why?
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")
}
How can i get already registred person uid in rgistrservice.
Please help me in this issue.. i got stuck here from long time.
Aucun commentaire:
Enregistrer un commentaire