if self.rememberPwd && !self.encryptedPwd { // 将账号和密码保存到keychain中 KeychainSwift().set(self.realUserName, forKey: "thorgeneRememberedUserName") let encPwd = try SwiftyRSA.encryptString(self.passwordTextField.text!, publicKeyPEM: response!["public_key"] as! String, padding: .OAEP) KeychainSwift().set(encPwd, forKey: "thorgeneRememberedPassword") NSUserDefaults.standardUserDefaults().setBool(true, forKey: "rememberPwdEnabled") } catch { KeychainSwift().delete("thorgeneRememberedUserName") NSUserDefaults.standardUserDefaults().setBool(false, forKey: "rememberPwdEnabled")