我正在使用https://github.com/matthewpalmer/Locksmith updateData方法.
它在Github Repo上说
as well as replacing existing data,this writes data to the keychain if it does not exist already
try Locksmith.updateData([“some key”: “another value”],forUserAccount: “myUserAccount”)
这就是我所拥有的:
let dictionary = Locksmith.loadDataForUserAccount("gameKeyChainValues")print("Ended \(EndDateAndTimeString)")do { try Locksmith.updateData(["BattleEnd": "12345678"],forUserAccount: "gameKeyChainValues")}catch { print("Unable to set time")}print("This line ran")if let timeBattleEnded = dictionary!["BattleEnd"] as? String { print("Stored for END: \(timeBattleEnded)")}
此行打印(“Ended(EndDateAndTimeString)”)输出:
Ended 19:33:38+2016-08-05
此行打印(“无法设置时间”)不执行任何 *** 作
此行打印(“此行运行”)输出:
This line ran
这一行:print(“存储为END 总结
以上是内存溢出为你收集整理的Swift Locksmith:不存储价值全部内容,希望文章能够帮你解决Swift Locksmith:不存储价值所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)