加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Swift Locksmith:不存储价值

发布时间:2020-12-14 04:40:21 所属栏目:百科 来源:网络整理
导读:我试图在游戏结束时存储一个值. 我正在使用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.updateDat
我试图在游戏结束时存储一个值.

我正在使用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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读