swift - 我如何在 Swift 中解析 TextField iOS Keychain?

标签 swift swifty-json

我通过 Locksmith Keychain 保存了我的帐户,一切正常,现在我需要解析存储到文本字段的数据,请问我该怎么做? 这是我用来保存帐户的代码:

let accountsave = Locksmith.saveData(["account": self.txtAccount.text], forUserAccount: "myUserAccount", inService: "myAccount").

现在我需要快速将数据存储解析为文本字段。请帮忙

最佳答案

根据我对您问题的理解,您要求的是与此类似的内容:

let (dictionary, error) = Locksmith.loadDataForUserAccount("myUserAccount", inService: "myAccount")
if let userData = dictionary as? [String:String] {
    if let account = userData["account"] {
        self.txtAccount.text = account
    }
}

关于swift - 我如何在 Swift 中解析 TextField iOS Keychain?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29988261/

相关文章:

ios - UIApplication 的 `beginIgnoringInteractionEvents` 不工作

objective-c - Swift 与 Objective-C 协议(protocol)

swift - 如何使用 Parse Server API 格式在 iOS 中存储和访问 JSON?

json - Swift 从循环内部追加到数组

ios - 在 Swift 中循环遍历 Alamofire JSON 结果

swift - 我的 API 请求代码产生了一个我无法调试或理解的错误

ios - 如何在 Swift 的横向模式下更改图标的旋转?

字符串不是对象

为函数提供 2 个闭包的 Swifty 方法

ios - 结果不会从 JSON 附加